summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
authorSven Nierlein <sven@nierlein.de>2014-06-24 13:07:44 (GMT)
committerSven Nierlein <sven@nierlein.de>2014-06-24 13:07:44 (GMT)
commitb35d12e931c6d330291f5c5f4847c33a122c63cb (patch)
tree65a773b10464cf527a6402e207f92ac1118f2542 /plugins/t
parent580bdd286379f6d8b678b9a7472572cfa2684aaf (diff)
downloadmonitoring-plugins-b35d12e931c6d330291f5c5f4847c33a122c63cb.tar.gz
tests: always build and test on travisrefs/pull/1261/head
also make test is now working on travis-ci Signed-off-by: Sven Nierlein <sven@nierlein.de>
Diffstat (limited to 'plugins/t')
-rw-r--r--plugins/t/NPTest.cache.travis54
-rw-r--r--plugins/t/check_ntp.t10
-rw-r--r--plugins/t/check_snmp.t2
-rw-r--r--plugins/t/check_udp.t2
4 files changed, 61 insertions, 7 deletions
diff --git a/plugins/t/NPTest.cache.travis b/plugins/t/NPTest.cache.travis
new file mode 100644
index 0000000..c1007de
--- /dev/null
+++ b/plugins/t/NPTest.cache.travis
@@ -0,0 +1,54 @@
1{
2 'MYSQL_LOGIN_DETAILS' => '-u root -d test',
3 'NP_ALLOW_SUDO' => 'yes',
4 'NP_DNS_SERVER' => '8.8.8.8',
5 'NP_GOOD_NTP_SERVICE' => '',
6 'NP_HOSTNAME_INVALID' => 'nosuchhost',
7 'NP_HOSTNAME_VALID' => 'monitoringplugins.org',
8 'NP_HOSTNAME_VALID_IP' => '130.133.8.40',
9 'NP_HOSTNAME_VALID_REVERSE' => 'orwell.monitoring-plugins.org.',
10 'NP_HOST_DHCP_RESPONSIVE' => '',
11 'NP_HOST_NONRESPONSIVE' => '10.0.0.1',
12 'NP_HOST_RESPONSIVE' => 'localhost',
13 'NP_HOST_SMB' => '',
14 'NP_HOST_SNMP' => '',
15 'NP_HOST_TCP_FTP' => '',
16 'NP_HOST_TCP_HPJD' => '',
17 'NP_HOST_TCP_HTTP' => 'localhost',
18 'NP_HOST_TCP_HTTP2' => 'labs.consol.de',
19 'NP_HOST_TCP_IMAP' => 'imap.web.de',
20 'NP_HOST_TCP_POP' => 'pop.web.de',
21 'NP_HOST_TCP_SMTP' => 'localhost',
22 'NP_HOST_TCP_SMTP_NOTLS' => '',
23 'NP_HOST_TCP_SMTP_TLS' => '',
24 'NP_INTERNET_ACCESS' => 'yes',
25 'NP_MOUNTPOINT2_VALID' => '',
26 'NP_MOUNTPOINT_VALID' => '/',
27 'NP_MYSQL_SERVER' => 'localhost',
28 'NP_HOST_UDP_TIME' => 'localhost',
29 'NP_MYSQL_SOCKET' => '/var/run/mysqld/mysqld.sock',
30 'NP_MYSQL_WITH_SLAVE' => '',
31 'NP_MYSQL_WITH_SLAVE_LOGIN' => '',
32 'NP_NO_NTP_SERVICE' => 'localhost',
33 'NP_SMB_SHARE' => '',
34 'NP_SMB_SHARE_DENY' => '',
35 'NP_SMB_SHARE_SPC' => '',
36 'NP_SMB_VALID_USER' => '',
37 'NP_SMB_VALID_USER_PASS' => '',
38 'NP_SNMP_COMMUNITY' => '',
39 'NP_SSH_CONFIGFILE' => '~/.ssh/config',
40 'NP_SSH_HOST' => 'localhost',
41 'NP_SSH_IDENTITY' => '~/.ssh/id_dsa',
42 'NP_HOST_TCP_JABBER' => 'jabber.org',
43 'host_nonresponsive' => '10.0.0.1',
44 'host_responsive' => 'localhost',
45 'host_snmp' => '',
46 'host_tcp_ftp' => '',
47 'host_tcp_http' => 'localhost',
48 'host_tcp_imap' => 'imap.nierlein.de',
49 'host_tcp_smtp' => 'localhost',
50 'hostname_invalid' => 'nosuchhost',
51 'snmp_community' => '',
52 'user_snmp' => '',
53 'host_udp_time' => 'none',
54}
diff --git a/plugins/t/check_ntp.t b/plugins/t/check_ntp.t
index 3eee6e1..74d890f 100644
--- a/plugins/t/check_ntp.t
+++ b/plugins/t/check_ntp.t
@@ -23,12 +23,12 @@ my $no_ntp_service = getTestParameter( "NP_NO_NTP_SERVICE",
23 "A host NOT providing the NTP service", 23 "A host NOT providing the NTP service",
24 "localhost" ); 24 "localhost" );
25 25
26my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE", 26my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE",
27 "The hostname of system not responsive to network requests", 27 "The hostname of system not responsive to network requests",
28 "10.0.0.1" ); 28 "10.0.0.1" );
29 29
30my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID", 30my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID",
31 "An invalid (not known to DNS) hostname", 31 "An invalid (not known to DNS) hostname",
32 "nosuchhost"); 32 "nosuchhost");
33 33
34my $ntp_okmatch1 = '/^NTP\sOK:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs/'; 34my $ntp_okmatch1 = '/^NTP\sOK:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs/';
@@ -43,7 +43,7 @@ my $ntp_nosuchhost = '/^check_ntp.*: Invalid hostname/address - ' . $hostname_in
43 43
44foreach my $plugin (@PLUGINS1) { 44foreach my $plugin (@PLUGINS1) {
45 SKIP: { 45 SKIP: {
46 skip "No NTP server defined", 1 unless $ntp_service; 46 skip "No NTP server defined", 6 unless $ntp_service;
47 $res = NPTest->testCmd( 47 $res = NPTest->testCmd(
48 "./$plugin -H $ntp_service -w 1000 -c 2000" 48 "./$plugin -H $ntp_service -w 1000 -c 2000"
49 ); 49 );
@@ -88,7 +88,7 @@ foreach my $plugin (@PLUGINS1) {
88 88
89foreach my $plugin (@PLUGINS2) { 89foreach my $plugin (@PLUGINS2) {
90 SKIP: { 90 SKIP: {
91 skip "No NTP server defined", 1 unless $ntp_service; 91 skip "No NTP server defined", 6 unless $ntp_service;
92 $res = NPTest->testCmd( 92 $res = NPTest->testCmd(
93 "./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k 200000 -m 1: -n 0:" 93 "./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k 200000 -m 1: -n 0:"
94 ); 94 );
diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t
index c35d782..2d6c44a 100644
--- a/plugins/t/check_snmp.t
+++ b/plugins/t/check_snmp.t
@@ -45,7 +45,7 @@ is( $res->return_code, 3, "Invalid protocol" );
45like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" ); 45like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" );
46 46
47SKIP: { 47SKIP: {
48 skip "no snmp host defined", 38 if ( ! $host_snmp ); 48 skip "no snmp host defined", 48 if ( ! $host_snmp );
49 49
50 $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:"); 50 $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:");
51 cmp_ok( $res->return_code, '==', 0, "Exit OK when querying uptime" ); 51 cmp_ok( $res->return_code, '==', 0, "Exit OK when querying uptime" );
diff --git a/plugins/t/check_udp.t b/plugins/t/check_udp.t
index 619cadf..1f6fee7 100644
--- a/plugins/t/check_udp.t
+++ b/plugins/t/check_udp.t
@@ -62,7 +62,7 @@ SKIP: {
62 cmp_ok( $res->return_code, '==', '2', "Hung waiting for response"); 62 cmp_ok( $res->return_code, '==', '2', "Hung waiting for response");
63 like ( $res->output, '/Socket timeout after 5 seconds/', "Timeout message"); 63 like ( $res->output, '/Socket timeout after 5 seconds/', "Timeout message");
64 like ( $duration, '/^[56]$/', "Timeout after 5 (possibly 6) seconds"); 64 like ( $duration, '/^[56]$/', "Timeout after 5 (possibly 6) seconds");
65 my $read_nc = <NC>; 65 my $read_nc = <NC> || '';
66 close NC; 66 close NC;
67 cmp_ok( $read_nc, 'eq', "foofoo", "Data received correctly" ); 67 cmp_ok( $read_nc, 'eq', "foofoo", "Data received correctly" );
68} 68}