summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins-scripts/t/check_ifoperstatus.t8
-rw-r--r--plugins-scripts/t/check_ifstatus.t8
-rw-r--r--plugins/t/check_snmp.t8
3 files changed, 15 insertions, 9 deletions
diff --git a/plugins-scripts/t/check_ifoperstatus.t b/plugins-scripts/t/check_ifoperstatus.t
index 1d6114f..2feb364 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 }
diff --git a/plugins-scripts/t/check_ifstatus.t b/plugins-scripts/t/check_ifstatus.t
index fc7052a..7d0220a 100644
--- a/plugins-scripts/t/check_ifstatus.t
+++ b/plugins-scripts/t/check_ifstatus.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 $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE", 25 my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE",
@@ -49,15 +49,17 @@ SKIP: {
49 49
50 } 50 }
51 51
52 # These checks need a complete command line. An invalid community is used so
53 # the tests can run on hosts w/o snmp host/community in NPTest.cache. Execution will fail anyway
52 SKIP: { 54 SKIP: {
53 skip "no non responsive host defined", 1 if ( ! $host_nonresponsive ); 55 skip "no non responsive host defined", 1 if ( ! $host_nonresponsive );
54 $res = NPTest->testCmd( "./$plugin -H $host_nonresponsive -C $snmp_community"); 56 $res = NPTest->testCmd( "./$plugin -H $host_nonresponsive -C np_foobar");
55 cmp_ok( $res->return_code, '==', 2, "Exit CRITICAL with non responsive host" ); 57 cmp_ok( $res->return_code, '==', 2, "Exit CRITICAL with non responsive host" );
56 } 58 }
57 59
58 SKIP: { 60 SKIP: {
59 skip "no invalid host defined", 2 if ( ! $hostname_invalid ); 61 skip "no invalid host defined", 2 if ( ! $hostname_invalid );
60 $res = NPTest->testCmd( "./$plugin -H $hostname_invalid -C $snmp_community"); 62 $res = NPTest->testCmd( "./$plugin -H $hostname_invalid -C np_foobar");
61 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with invalid host" ); 63 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with invalid host" );
62 like($res->output, "/Unable to resolve.*$hostname_invalid/", "String matches unable to resolve.*$hostname_invalid"); 64 like($res->output, "/Unable to resolve.*$hostname_invalid/", "String matches unable to resolve.*$hostname_invalid");
63 } 65 }
diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t
index 6cc97b6..cda12f4 100644
--- a/plugins/t/check_snmp.t
+++ b/plugins/t/check_snmp.t
@@ -44,7 +44,7 @@ SKIP: {
44 like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" ); 44 like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" );
45 45
46 SKIP: { 46 SKIP: {
47 skip "no snmp host defined", 30 if ( ! $host_snmp ); 47 skip "no snmp host defined", 32 if ( ! $host_snmp );
48 48
49 $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:"); 49 $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:");
50 cmp_ok( $res->return_code, '==', 0, "Exit OK when querying uptime" ); 50 cmp_ok( $res->return_code, '==', 0, "Exit OK when querying uptime" );
@@ -114,16 +114,18 @@ SKIP: {
114 114
115 } 115 }
116 116
117 # These checks need a complete command line. An invalid community is used so
118 # the tests can run on hosts w/o snmp host/community in NPTest.cache. Execution will fail anyway
117 SKIP: { 119 SKIP: {
118 skip "no non responsive host defined", 2 if ( ! $host_nonresponsive ); 120 skip "no non responsive host defined", 2 if ( ! $host_nonresponsive );
119 $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:"); 121 $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
120 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" ); 122 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" );
121 like($res->output, '/External command error: Timeout: No Response from /', "String matches timeout problem"); 123 like($res->output, '/External command error: Timeout: No Response from /', "String matches timeout problem");
122 } 124 }
123 125
124 SKIP: { 126 SKIP: {
125 skip "no non invalid host defined", 2 if ( ! $hostname_invalid ); 127 skip "no non invalid host defined", 2 if ( ! $hostname_invalid );
126 $res = NPTest->testCmd( "./check_snmp -H $hostname_invalid -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:"); 128 $res = NPTest->testCmd( "./check_snmp -H $hostname_invalid -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
127 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" ); 129 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" );
128 like($res->output, '/External command error: .*(nosuchhost|Name or service not known|Unknown host)/', "String matches invalid host"); 130 like($res->output, '/External command error: .*(nosuchhost|Name or service not known|Unknown host)/', "String matches invalid host");
129 } 131 }