aboutsummaryrefslogtreecommitdiff
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
-rw-r--r--plugins/t/NPTest.cache.travis54
-rw-r--r--plugins/t/check_curl.t7
-rw-r--r--plugins/t/check_fping.t32
-rw-r--r--plugins/t/check_http.t4
4 files changed, 19 insertions, 78 deletions
diff --git a/plugins/t/NPTest.cache.travis b/plugins/t/NPTest.cache.travis
deleted file mode 100644
index 9b9f8059..00000000
--- a/plugins/t/NPTest.cache.travis
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- 'NP_ALLOW_SUDO' => 'yes',
- 'NP_DNS_SERVER' => '8.8.8.8',
- 'NP_GOOD_NTP_SERVICE' => '',
- 'NP_HOST_DHCP_RESPONSIVE' => '',
- 'NP_HOST_HPJD_PORT_INVALID' => '161',
- 'NP_HOST_HPJD_PORT_VALID' => '',
- 'NP_HOSTNAME_INVALID_CIDR' => '130.133.8.39/30',
- 'NP_HOSTNAME_INVALID' => 'nosuchhost',
- 'NP_HOSTNAME_VALID_CIDR' => '130.133.8.41/30',
- 'NP_HOSTNAME_VALID_IP' => '130.133.8.40',
- 'NP_HOSTNAME_VALID' => 'monitoring-plugins.org',
- 'NP_HOSTNAME_VALID_REVERSE' => 'orwell.monitoring-plugins.org.',
- 'NP_HOST_NONRESPONSIVE' => '10.0.0.1',
- 'NP_HOST_RESPONSIVE' => 'localhost',
- 'NP_HOST_SMB' => '',
- 'NP_HOST_SNMP' => '',
- 'NP_HOST_TCP_FTP' => '',
- 'NP_HOST_TCP_HPJD' => '',
- 'NP_HOST_TCP_HTTP2' => 'test.monitoring-plugins.org',
- 'NP_HOST_TCP_HTTP' => 'localhost',
- 'NP_HOST_TCP_IMAP' => 'imap.web.de',
- 'NP_HOST_TCP_JABBER' => 'jabber.org',
- 'NP_HOST_TCP_LDAP' => 'localhost',
- 'NP_HOST_TCP_POP' => 'pop.web.de',
- 'NP_HOST_TCP_PROXY' => 'localhost',
- 'NP_HOST_TCP_SMTP' => 'localhost',
- 'NP_HOST_TCP_SMTP_NOTLS' => '',
- 'NP_HOST_TCP_SMTP_TLS' => '',
- 'NP_HOST_TLS_CERT' => 'localhost,
- 'NP_HOST_TLS_HTTP' => 'localhost',
- 'NP_HOST_UDP_TIME' => 'none',
- 'NP_INTERNET_ACCESS' => 'yes',
- 'NP_LDAP_BASE_DN' => 'cn=admin,dc=nodomain',
- 'NP_MOUNTPOINT2_VALID' => '/media/ramdisk',
- 'NP_MOUNTPOINT_VALID' => '/',
- 'NP_MYSQL_LOGIN_DETAILS' => '-u root -d test',
- 'NP_MYSQL_SERVER' => 'localhost',
- 'NP_MYSQL_SOCKET' => '/var/run/mysqld/mysqld.sock',
- 'NP_MYSQL_WITH_SLAVE' => '',
- 'NP_MYSQL_WITH_SLAVE_LOGIN' => '',
- 'NP_NO_NTP_SERVICE' => 'localhost',
- 'NP_PORT_TCP_PROXY' => '3128',
- 'NP_SMB_SHARE' => '',
- 'NP_SMB_SHARE_DENY' => '',
- 'NP_SMB_SHARE_SPC' => '',
- 'NP_SMB_VALID_USER' => '',
- 'NP_SMB_VALID_USER_PASS' => '',
- 'NP_SNMP_COMMUNITY' => '',
- 'NP_SNMP_USER' => '',
- 'NP_SSH_CONFIGFILE' => '~/.ssh/config',
- 'NP_SSH_HOST' => 'localhost',
- 'NP_SSH_IDENTITY' => '~/.ssh/id_rsa'
-}
diff --git a/plugins/t/check_curl.t b/plugins/t/check_curl.t
index a4f1dfb3..45ee5339 100644
--- a/plugins/t/check_curl.t
+++ b/plugins/t/check_curl.t
@@ -84,7 +84,7 @@ like( $res->output, '/^Host: testhost:8001\s*$/ms', "Host Header OK" );
like( $res->output, '/CURLOPT_URL: http:\/\/'.$host_tcp_http.':80\//ms', "Url OK" );
SKIP: {
- skip "No internet access", 3 if $internet_access eq "no";
+ skip "No internet access", 4 if $internet_access eq "no";
$res = NPTest->testCmd("./$plugin -v -H $host_tls_http -S");
like( $res->output, '/^Host: '.$host_tls_http.'\s*$/ms', "Host Header OK" );
@@ -120,7 +120,7 @@ SKIP: {
cmp_ok( $res->return_code, "==", 0, "And also when not found");
}
SKIP: {
- skip "No internet access", 16 if $internet_access eq "no";
+ skip "No internet access", 28 if $internet_access eq "no";
$res = NPTest->testCmd(
"./$plugin --ssl $host_tls_http"
@@ -193,8 +193,7 @@ SKIP: {
);
cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" );
-
- $res = NPTest->testCmd( "./$plugin -H www.mozilla.com -u /firefox -f follow" );
+ $res = NPTest->testCmd( "./$plugin -H www.mozilla.com -u /firefox -f curl" );
is( $res->return_code, 0, "Redirection based on location is okay");
$res = NPTest->testCmd( "./$plugin -H www.mozilla.com --extended-perfdata" );
diff --git a/plugins/t/check_fping.t b/plugins/t/check_fping.t
index 342b0a7e..67b357b2 100644
--- a/plugins/t/check_fping.t
+++ b/plugins/t/check_fping.t
@@ -5,34 +5,30 @@
#
use strict;
-use Test;
+use Test::More;
use NPTest;
-use vars qw($tests);
-
-BEGIN {$tests = 4; plan tests => $tests}
-
-my $successOutput = '/^FPING OK - /';
-my $failureOutput = '/^FPING CRITICAL - /';
-
my $host_responsive = getTestParameter("NP_HOST_RESPONSIVE", "The hostname of system responsive to network requests", "localhost");
my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1");
my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost");
-my $t;
+my $res;
my $fping = qx(which fping 2> /dev/null);
chomp($fping);
if( ! -x "./check_fping") {
- $t += skipMissingCmd( "./check_fping", $tests );
+ plan skip_all => "check_fping not found, skipping tests";
}
-elsif ( $> != 0 && (!$fping || ! -u $fping)) {
- $t += skipMsg( "./check_fping", $tests );
+elsif ( !$fping || !-x $fping ) {
+ plan skip_all => "fping not found or cannot be executed, skipping tests";
} else {
- $t += checkCmd( "./check_fping $host_responsive", 0, $successOutput );
- $t += checkCmd( "./check_fping $host_nonresponsive", [ 1, 2 ] );
- $t += checkCmd( "./check_fping $hostname_invalid", [ 1, 2 ] );
-}
+ plan tests => 3;
+ $res = NPTest->testCmd( "./check_fping $host_responsive" );
+ cmp_ok( $res->return_code, '==', 0, "Responsive host returns OK");
+
+ $res = NPTest->testCmd( "./check_fping $host_nonresponsive" );
+ cmp_ok( $res->return_code, '==', 2, "Non-Responsive host returns Critical");
-exit(0) if defined($Test::Harness::VERSION);
-exit($tests - $t);
+ $res = NPTest->testCmd( "./check_fping $hostname_invalid" );
+ cmp_ok( $res->return_code, '==', 3, "Invalid host returns Unknown");
+}
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t
index e92681e9..c137f7b4 100644
--- a/plugins/t/check_http.t
+++ b/plugins/t/check_http.t
@@ -103,7 +103,7 @@ SKIP: {
cmp_ok( $res->return_code, "==", 0, "And also when not found");
}
SKIP: {
- skip "No internet access", 16 if $internet_access eq "no";
+ skip "No internet access", 23 if $internet_access eq "no";
$res = NPTest->testCmd(
"./$plugin --ssl $host_tls_http"
@@ -135,7 +135,7 @@ SKIP: {
# run some certificate checks with faketime
SKIP: {
- skip "No faketime binary found", 12 if !$faketime;
+ skip "No faketime binary found", 7 if !$faketime;
$res = NPTest->testCmd("LC_TIME=C TZ=UTC ./$plugin -C 1 $host_tls_http");
like($res->output, qr/OK - Certificate '$host_tls_cert' will expire on/, "Catch cert output");
is( $res->return_code, 0, "Catch cert output exit code" );