[monitoring-plugins] check_snmp: add testcase for no datatype

Sven Nierlein git at monitoring-plugins.org
Tue Nov 8 00:30:13 CET 2016


 Module: monitoring-plugins
 Branch: master
 Commit: 1d4874240a05c2a847e6ec74ff31acb3d3ed1449
 Author: Sven Nierlein <sven at nierlein.de>
   Date: Tue Nov  8 00:29:42 2016 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=1d48742

check_snmp: add testcase for no datatype

Signed-off-by: Sven Nierlein <sven at nierlein.de>

---

 plugins/t/check_snmp.t | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t
index aefd872..6f870d4 100644
--- a/plugins/t/check_snmp.t
+++ b/plugins/t/check_snmp.t
@@ -10,7 +10,7 @@ use NPTest;
 
 BEGIN {
     plan skip_all => 'check_snmp is not compiled' unless -x "./check_snmp";
-    plan tests => 61;
+    plan tests => 63;
 }
 
 my $res;
@@ -153,6 +153,10 @@ SKIP: {
     $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0");
     cmp_ok( $res->return_code, '==', 0, "Timetick used as a string");
     like($res->output, '/^SNMP OK - Timeticks:\s\(\d+\)\s+(?:\d+ days?,\s+)?\d+:\d+:\d+\.\d+\s.*$/', "Timetick used as a string, result printed rather than parsed");
+
+    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o HOST-RESOURCES-MIB::hrSWRunParameters.1");
+    cmp_ok( $res->return_code, '==', 0, "Timetick used as a string");
+    is( $res->output, 'SNMP OK - "" | ', "snmp response without datatype" );
 }
 
 SKIP: {



More information about the Commits mailing list