summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2009-09-05 07:16:54 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2009-09-05 07:16:54 (GMT)
commit181ac1e0182b01bc15188ada6f6239c652f55821 (patch)
tree05de8b399b614deb8234a3ce4f7e4aee3defc4d0
parentb8a64210bd44d792de6defcdddec65231c1ac65b (diff)
downloadmonitoring-plugins-181ac1e0182b01bc15188ada6f6239c652f55821.tar.gz
Add a test that succeeds on check_snmp v1.4.13. Newer versions skip additional
lines so this new test fails on the current head. Note: check_snmp v1.4.13 with multi-line strings return somewhat v3 output; it's not exactly what the specs say but it doesn't appears to break them either. The fix could eventually supports both v2 and v3 output formats.
-rwxr-xr-xplugins/tests/check_snmp.t9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t
index fcd15ea..5605b00 100755
--- a/plugins/tests/check_snmp.t
+++ b/plugins/tests/check_snmp.t
@@ -41,7 +41,7 @@ if ($ARGV[0] && $ARGV[0] eq "-d") {
41 } 41 }
42} 42}
43 43
44my $tests = 2; 44my $tests = 3;
45if (-x "./check_snmp") { 45if (-x "./check_snmp") {
46 plan tests => $tests; 46 plan tests => $tests;
47} else { 47} else {
@@ -53,4 +53,11 @@ my $res;
53$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.0"); 53$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.0");
54cmp_ok( $res->return_code, '==', 0, "Exit OK when querying a multi-line string" ); 54cmp_ok( $res->return_code, '==', 0, "Exit OK when querying a multi-line string" );
55like($res->output, '/^SNMP OK - /', "String contains SNMP OK"); 55like($res->output, '/^SNMP OK - /', "String contains SNMP OK");
56like($res->output, '/'.quotemeta('SNMP OK - "Cisco Internetwork Operating System SoftwareIOS (tm) Catalyst 4000 L3 Switch Software (cat4000-I9K91S-M), Version
5712.2(20)EWA, RELEASE SOFTWARE (fc1)
58Technical Support: http://www.cisco.com/techsupport
59Copyright (c) 1986-2004 by cisco Systems, Inc.
60"').'/m', "String contains all lines");
61
62print $res->output;
56 63