aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Matthias Eble <psychotrahe@gmx.de> 2009-06-13 18:13:49 +0200
committerGravatar Matthias Eble <psychotrahe@gmx.de> 2009-06-13 18:13:49 +0200
commit38e20a1a3369bf470b8ce9b66ca5dfb57302e009 (patch)
treefb4ffd31aa4b1312273e57505c466d8392df3890 /plugins
parent05b801284c714e2e39a4fffc69d11d9cb78fe5ef (diff)
downloadmonitoring-plugins-38e20a1a3369bf470b8ce9b66ca5dfb57302e009.tar.gz
Fixed testcases for check_snmp, check_ifstatus and check_ifoperstatus when no snmp community is specified
The checks for invalid/unavailable hosts need a complete command line. They failed on hosts where no community was specified. Now, an invalid community is used so the tests can run on hosts w/o snmp host/community in NPTest.cache. Execution will fail anyway.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/t/check_snmp.t8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t
index 6cc97b6e..cda12f47 100644
--- a/plugins/t/check_snmp.t
+++ b/plugins/t/check_snmp.t
@@ -44,7 +44,7 @@ SKIP: {
like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" );
SKIP: {
- skip "no snmp host defined", 30 if ( ! $host_snmp );
+ skip "no snmp host defined", 32 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" );
@@ -114,16 +114,18 @@ SKIP: {
}
+ # These checks need a complete command line. An invalid community is used so
+ # the tests can run on hosts w/o snmp host/community in NPTest.cache. Execution will fail anyway
SKIP: {
skip "no non responsive host defined", 2 if ( ! $host_nonresponsive );
- $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:");
+ $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" );
like($res->output, '/External command error: Timeout: No Response from /', "String matches timeout problem");
}
SKIP: {
skip "no non invalid host defined", 2 if ( ! $hostname_invalid );
- $res = NPTest->testCmd( "./check_snmp -H $hostname_invalid -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:");
+ $res = NPTest->testCmd( "./check_snmp -H $hostname_invalid -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" );
like($res->output, '/External command error: .*(nosuchhost|Name or service not known|Unknown host)/', "String matches invalid host");
}