diff options
| author | Matthias Eble <psychotrahe@gmx.de> | 2009-06-13 18:13:49 +0200 |
|---|---|---|
| committer | Matthias Eble <psychotrahe@gmx.de> | 2009-06-13 18:13:49 +0200 |
| commit | 38e20a1a3369bf470b8ce9b66ca5dfb57302e009 (patch) | |
| tree | fb4ffd31aa4b1312273e57505c466d8392df3890 /plugins-scripts/t/check_ifoperstatus.t | |
| parent | 05b801284c714e2e39a4fffc69d11d9cb78fe5ef (diff) | |
| download | monitoring-plugins-38e20a1a3369bf470b8ce9b66ca5dfb57302e009.tar.gz | |
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.
Diffstat (limited to 'plugins-scripts/t/check_ifoperstatus.t')
| -rw-r--r-- | plugins-scripts/t/check_ifoperstatus.t | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins-scripts/t/check_ifoperstatus.t b/plugins-scripts/t/check_ifoperstatus.t index 1d6114f6..2feb3646 100644 --- a/plugins-scripts/t/check_ifoperstatus.t +++ b/plugins-scripts/t/check_ifoperstatus.t | |||
| @@ -19,7 +19,7 @@ SKIP: { | |||
| 19 | my $host_snmp = getTestParameter( "NP_HOST_SNMP", "A host providing an SNMP Service", "localhost"); | 19 | my $host_snmp = getTestParameter( "NP_HOST_SNMP", "A host providing an SNMP Service", "localhost"); |
| 20 | 20 | ||
| 21 | my $snmp_community = getTestParameter( "NP_SNMP_COMMUNITY", | 21 | my $snmp_community = getTestParameter( "NP_SNMP_COMMUNITY", |
| 22 | "The SNMP Community string for SNMP Testing (pick default rather than 'none' when no snmp host is available)", | 22 | "The SNMP Community string for SNMP Testing", |
| 23 | "public"); | 23 | "public"); |
| 24 | 24 | ||
| 25 | my ($snmp_interface, $snmp_ifxtable); | 25 | my ($snmp_interface, $snmp_ifxtable); |
| @@ -75,15 +75,17 @@ SKIP: { | |||
| 75 | 75 | ||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | # These checks need a complete command line. An invalid community is used so | ||
| 79 | # the tests can run on hosts w/o snmp host/community in NPTest.cache. Execution will fail anyway | ||
| 78 | SKIP: { | 80 | SKIP: { |
| 79 | skip "no non responsive host defined", 1 if ( ! $host_nonresponsive ); | 81 | skip "no non responsive host defined", 1 if ( ! $host_nonresponsive ); |
| 80 | $res = NPTest->testCmd( "./$plugin -H $host_nonresponsive -C $snmp_community -k 1"); | 82 | $res = NPTest->testCmd( "./$plugin -H $host_nonresponsive -C np_foobar -k 1"); |
| 81 | cmp_ok( $res->return_code, '==', 1, "Exit WARNING with non responsive host" ); | 83 | cmp_ok( $res->return_code, '==', 1, "Exit WARNING with non responsive host" ); |
| 82 | } | 84 | } |
| 83 | 85 | ||
| 84 | SKIP: { | 86 | SKIP: { |
| 85 | skip "no invalid host defined", 2 if ( ! $hostname_invalid ); | 87 | skip "no invalid host defined", 2 if ( ! $hostname_invalid ); |
| 86 | $res = NPTest->testCmd( "./$plugin -H $hostname_invalid -C $snmp_community -k 1"); | 88 | $res = NPTest->testCmd( "./$plugin -H $hostname_invalid -C np_foobar -k 1"); |
| 87 | cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with invalid host" ); | 89 | cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with invalid host" ); |
| 88 | like($res->output, "/Unable to resolve.*$hostname_invalid/", "String matches unable to resolve.*$hostname_invalid"); | 90 | like($res->output, "/Unable to resolve.*$hostname_invalid/", "String matches unable to resolve.*$hostname_invalid"); |
| 89 | } | 91 | } |
