Revision: 2222
http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2222&view=rev
Author: dermoth
Date: 2009-06-13 16:17:35 +0000 (Sat, 13 Jun 2009)
Log Message:
-----------
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.
From: Matthias Eble <[email protected]>
Modified Paths:
--------------
nagiosplug/trunk/plugins/t/check_snmp.t
nagiosplug/trunk/plugins-scripts/t/check_ifoperstatus.t
nagiosplug/trunk/plugins-scripts/t/check_ifstatus.t
Modified: nagiosplug/trunk/plugins/t/check_snmp.t
===================================================================
--- nagiosplug/trunk/plugins/t/check_snmp.t 2009-06-13 09:20:16 UTC (rev 2221)
+++ nagiosplug/trunk/plugins/t/check_snmp.t 2009-06-13 16:17:35 UTC (rev 2222)
@@ -44,7 +44,7 @@
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 @@
}
+ # 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");
}
Modified: nagiosplug/trunk/plugins-scripts/t/check_ifoperstatus.t
===================================================================
--- nagiosplug/trunk/plugins-scripts/t/check_ifoperstatus.t 2009-06-13 09:20:16 UTC (rev 2221)
+++ nagiosplug/trunk/plugins-scripts/t/check_ifoperstatus.t 2009-06-13 16:17:35 UTC (rev 2222)
@@ -19,7 +19,7 @@
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 ($snmp_interface, $snmp_ifxtable);
@@ -75,15 +75,17 @@
}
+ # 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 -k 1");
+ $res = NPTest->testCmd( "./$plugin -H $host_nonresponsive -C np_foobar -k 1");
cmp_ok( $res->return_code, '==', 1, "Exit WARNING with non responsive host" );
}
SKIP: {
skip "no invalid host defined", 2 if ( ! $hostname_invalid );
- $res = NPTest->testCmd( "./$plugin -H $hostname_invalid -C $snmp_community -k 1");
+ $res = NPTest->testCmd( "./$plugin -H $hostname_invalid -C np_foobar -k 1");
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");
}
Modified: nagiosplug/trunk/plugins-scripts/t/check_ifstatus.t
===================================================================
--- nagiosplug/trunk/plugins-scripts/t/check_ifstatus.t 2009-06-13 09:20:16 UTC (rev 2221)
+++ nagiosplug/trunk/plugins-scripts/t/check_ifstatus.t 2009-06-13 16:17:35 UTC (rev 2222)
@@ -19,7 +19,7 @@
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 @@
}
+ # 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");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.