From 38e20a1a3369bf470b8ce9b66ca5dfb57302e009 Mon Sep 17 00:00:00 2001 From: Matthias Eble Date: Sat, 13 Jun 2009 18:13:49 +0200 Subject: 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. --- plugins-scripts/t/check_ifstatus.t | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'plugins-scripts/t/check_ifstatus.t') diff --git a/plugins-scripts/t/check_ifstatus.t b/plugins-scripts/t/check_ifstatus.t index fc7052a6..7d0220a4 100644 --- a/plugins-scripts/t/check_ifstatus.t +++ b/plugins-scripts/t/check_ifstatus.t @@ -19,7 +19,7 @@ SKIP: { my $host_snmp = getTestParameter( "NP_HOST_SNMP", "A host providing an SNMP Service", "localhost"); my $snmp_community = getTestParameter( "NP_SNMP_COMMUNITY", - "The SNMP Community string for SNMP Testing (pick default rather than 'none' when no snmp host is available)", + "The SNMP Community string for SNMP Testing", "public"); my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE", @@ -49,15 +49,17 @@ 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", 1 if ( ! $host_nonresponsive ); - $res = NPTest->testCmd( "./$plugin -H $host_nonresponsive -C $snmp_community"); + $res = NPTest->testCmd( "./$plugin -H $host_nonresponsive -C np_foobar"); cmp_ok( $res->return_code, '==', 2, "Exit CRITICAL with non responsive host" ); } SKIP: { skip "no invalid host defined", 2 if ( ! $hostname_invalid ); - $res = NPTest->testCmd( "./$plugin -H $hostname_invalid -C $snmp_community"); + $res = NPTest->testCmd( "./$plugin -H $hostname_invalid -C np_foobar"); cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with invalid host" ); like($res->output, "/Unable to resolve.*$hostname_invalid/", "String matches unable to resolve.*$hostname_invalid"); } -- cgit v1.2.3