summaryrefslogtreecommitdiffstats
path: root/plugins/t/check_snmp.t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t/check_snmp.t')
-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 6cc97b6..cda12f4 100644
--- a/plugins/t/check_snmp.t
+++ b/plugins/t/check_snmp.t
@@ -44,7 +44,7 @@ SKIP: {
44 like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" ); 44 like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" );
45 45
46 SKIP: { 46 SKIP: {
47 skip "no snmp host defined", 30 if ( ! $host_snmp ); 47 skip "no snmp host defined", 32 if ( ! $host_snmp );
48 48
49 $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:"); 49 $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:");
50 cmp_ok( $res->return_code, '==', 0, "Exit OK when querying uptime" ); 50 cmp_ok( $res->return_code, '==', 0, "Exit OK when querying uptime" );
@@ -114,16 +114,18 @@ SKIP: {
114 114
115 } 115 }
116 116
117 # These checks need a complete command line. An invalid community is used so
118 # the tests can run on hosts w/o snmp host/community in NPTest.cache. Execution will fail anyway
117 SKIP: { 119 SKIP: {
118 skip "no non responsive host defined", 2 if ( ! $host_nonresponsive ); 120 skip "no non responsive host defined", 2 if ( ! $host_nonresponsive );
119 $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:"); 121 $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
120 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" ); 122 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" );
121 like($res->output, '/External command error: Timeout: No Response from /', "String matches timeout problem"); 123 like($res->output, '/External command error: Timeout: No Response from /', "String matches timeout problem");
122 } 124 }
123 125
124 SKIP: { 126 SKIP: {
125 skip "no non invalid host defined", 2 if ( ! $hostname_invalid ); 127 skip "no non invalid host defined", 2 if ( ! $hostname_invalid );
126 $res = NPTest->testCmd( "./check_snmp -H $hostname_invalid -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:"); 128 $res = NPTest->testCmd( "./check_snmp -H $hostname_invalid -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
127 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" ); 129 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" );
128 like($res->output, '/External command error: .*(nosuchhost|Name or service not known|Unknown host)/', "String matches invalid host"); 130 like($res->output, '/External command error: .*(nosuchhost|Name or service not known|Unknown host)/', "String matches invalid host");
129 } 131 }