[monitoring-plugins] tests: always build and test on travis
Sven Nierlein
git at monitoring-plugins.org
Tue Jun 24 15:10:09 CEST 2014
Module: monitoring-plugins
Branch: master
Commit: b35d12e931c6d330291f5c5f4847c33a122c63cb
Author: Sven Nierlein <sven at nierlein.de>
Date: Tue Jun 24 15:07:44 2014 +0200
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=b35d12e
tests: always build and test on travis
also make test is now working on travis-ci
Signed-off-by: Sven Nierlein <sven at nierlein.de>
---
.travis.yml | 12 +++++++++-
plugins/t/NPTest.cache.travis | 54 +++++++++++++++++++++++++++++++++++++++++++
plugins/t/check_ntp.t | 10 ++++----
plugins/t/check_snmp.t | 2 +-
plugins/t/check_udp.t | 2 +-
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:
install:
- 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
+ - sudo apt-get install -qq --no-install-recommends libdbi0-dev libdbd-sqlite3 libssl-dev dnsutils snmp-mibs-downloader
+ - sudo apt-get install -qq --no-install-recommends fping snmp netcat smbclient fping pure-ftpd apache2 postfix
- sudo apt-get install -qq --no-install-recommends autoconf automake
before_script:
- tools/setup
- ./configure
+ - make
+ - export NPTEST_CACHE="$(pwd)/plugins/t/NPTest.cache.travis"
+ - ssh-keygen -t dsa -N "" -f ~/.ssh/id_dsa
+ - cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
+ - ssh-keyscan localhost >> ~/.ssh/known_hosts
+ - touch ~/.ssh/config
+ - 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
+ - sudo mkdir -p /var/lib/snmp/mib_indexes
script:
- - if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then make; fi
+ - if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then make test; fi
notifications:
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 @@
+{
+ 'MYSQL_LOGIN_DETAILS' => '-u root -d test',
+ 'NP_ALLOW_SUDO' => 'yes',
+ 'NP_DNS_SERVER' => '8.8.8.8',
+ 'NP_GOOD_NTP_SERVICE' => '',
+ 'NP_HOSTNAME_INVALID' => 'nosuchhost',
+ 'NP_HOSTNAME_VALID' => 'monitoringplugins.org',
+ 'NP_HOSTNAME_VALID_IP' => '130.133.8.40',
+ 'NP_HOSTNAME_VALID_REVERSE' => 'orwell.monitoring-plugins.org.',
+ 'NP_HOST_DHCP_RESPONSIVE' => '',
+ '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_HTTP' => 'localhost',
+ 'NP_HOST_TCP_HTTP2' => 'labs.consol.de',
+ 'NP_HOST_TCP_IMAP' => 'imap.web.de',
+ 'NP_HOST_TCP_POP' => 'pop.web.de',
+ 'NP_HOST_TCP_SMTP' => 'localhost',
+ 'NP_HOST_TCP_SMTP_NOTLS' => '',
+ 'NP_HOST_TCP_SMTP_TLS' => '',
+ 'NP_INTERNET_ACCESS' => 'yes',
+ 'NP_MOUNTPOINT2_VALID' => '',
+ 'NP_MOUNTPOINT_VALID' => '/',
+ 'NP_MYSQL_SERVER' => 'localhost',
+ 'NP_HOST_UDP_TIME' => 'localhost',
+ 'NP_MYSQL_SOCKET' => '/var/run/mysqld/mysqld.sock',
+ 'NP_MYSQL_WITH_SLAVE' => '',
+ 'NP_MYSQL_WITH_SLAVE_LOGIN' => '',
+ 'NP_NO_NTP_SERVICE' => 'localhost',
+ 'NP_SMB_SHARE' => '',
+ 'NP_SMB_SHARE_DENY' => '',
+ 'NP_SMB_SHARE_SPC' => '',
+ 'NP_SMB_VALID_USER' => '',
+ 'NP_SMB_VALID_USER_PASS' => '',
+ 'NP_SNMP_COMMUNITY' => '',
+ 'NP_SSH_CONFIGFILE' => '~/.ssh/config',
+ 'NP_SSH_HOST' => 'localhost',
+ 'NP_SSH_IDENTITY' => '~/.ssh/id_dsa',
+ 'NP_HOST_TCP_JABBER' => 'jabber.org',
+ 'host_nonresponsive' => '10.0.0.1',
+ 'host_responsive' => 'localhost',
+ 'host_snmp' => '',
+ 'host_tcp_ftp' => '',
+ 'host_tcp_http' => 'localhost',
+ 'host_tcp_imap' => 'imap.nierlein.de',
+ 'host_tcp_smtp' => 'localhost',
+ 'hostname_invalid' => 'nosuchhost',
+ 'snmp_community' => '',
+ 'user_snmp' => '',
+ 'host_udp_time' => 'none',
+}
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",
"A host NOT providing the NTP service",
"localhost" );
-my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE",
+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",
+my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID",
+ "An invalid (not known to DNS) hostname",
"nosuchhost");
my $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
foreach my $plugin (@PLUGINS1) {
SKIP: {
- skip "No NTP server defined", 1 unless $ntp_service;
+ skip "No NTP server defined", 6 unless $ntp_service;
$res = NPTest->testCmd(
"./$plugin -H $ntp_service -w 1000 -c 2000"
);
@@ -88,7 +88,7 @@ foreach my $plugin (@PLUGINS1) {
foreach my $plugin (@PLUGINS2) {
SKIP: {
- skip "No NTP server defined", 1 unless $ntp_service;
+ skip "No NTP server defined", 6 unless $ntp_service;
$res = NPTest->testCmd(
"./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k 200000 -m 1: -n 0:"
);
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" );
like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" );
SKIP: {
- skip "no snmp host defined", 38 if ( ! $host_snmp );
+ skip "no snmp host defined", 48 if ( ! $host_snmp );
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:");
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: {
cmp_ok( $res->return_code, '==', '2', "Hung waiting for response");
like ( $res->output, '/Socket timeout after 5 seconds/', "Timeout message");
like ( $duration, '/^[56]$/', "Timeout after 5 (possibly 6) seconds");
- my $read_nc = <NC>;
+ my $read_nc = <NC> || '';
close NC;
cmp_ok( $read_nc, 'eq', "foofoo", "Data received correctly" );
}
More information about the Commits
mailing list