summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Nierlein <sven@nierlein.org>2014-06-24 13:08:41 (GMT)
committerSven Nierlein <sven@nierlein.org>2014-06-24 13:08:41 (GMT)
commit7508da9360a77c6799e74a8109b768a1b8fbba11 (patch)
tree65a773b10464cf527a6402e207f92ac1118f2542
parent580bdd286379f6d8b678b9a7472572cfa2684aaf (diff)
parentb35d12e931c6d330291f5c5f4847c33a122c63cb (diff)
downloadmonitoring-plugins-7508da9360a77c6799e74a8109b768a1b8fbba11.tar.gz
Merge pull request #1261 from sni/master
tests: always build and test on travis
-rw-r--r--.travis.yml12
-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
5 files changed, 72 insertions, 8 deletions
diff --git a/.travis.yml b/.travis.yml
index 7a4c3c6..02fa084 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,14 +6,24 @@ before_install:
6 6
7install: 7install:
8 - sudo apt-get install -qq --no-install-recommends perl autotools-dev libdbi-dev libldap2-dev libpq-dev libmysqlclient-dev libradiusclient-ng-dev libkrb5-dev libnet-snmp-perl procps 8 - sudo apt-get install -qq --no-install-recommends perl autotools-dev libdbi-dev libldap2-dev libpq-dev libmysqlclient-dev libradiusclient-ng-dev libkrb5-dev libnet-snmp-perl procps
9 - sudo apt-get install -qq --no-install-recommends libdbi0-dev libdbd-sqlite3 libssl-dev dnsutils snmp-mibs-downloader
10 - sudo apt-get install -qq --no-install-recommends fping snmp netcat smbclient fping pure-ftpd apache2 postfix
9 - sudo apt-get install -qq --no-install-recommends autoconf automake 11 - sudo apt-get install -qq --no-install-recommends autoconf automake
10 12
11before_script: 13before_script:
12 - tools/setup 14 - tools/setup
13 - ./configure 15 - ./configure
16 - make
17 - export NPTEST_CACHE="$(pwd)/plugins/t/NPTest.cache.travis"
18 - ssh-keygen -t dsa -N "" -f ~/.ssh/id_dsa
19 - cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
20 - ssh-keyscan localhost >> ~/.ssh/known_hosts
21 - touch ~/.ssh/config
22 - sudo rm -f /usr/share/mibs/ietf/SNMPv2-PDU /usr/share/mibs/ietf/IPSEC-SPD-MIB /usr/share/mibs/ietf/IPATM-IPMC-MIB /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
23 - sudo mkdir -p /var/lib/snmp/mib_indexes
14 24
15script: 25script:
16 - if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then make; fi 26 - if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then make test; fi
17 27
18notifications: 28notifications:
19 irc: 29 irc:
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}