summaryrefslogtreecommitdiffstats
path: root/plugins/tests/check_snmp.t
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2010-11-30 23:57:04 -0500
committerThomas Guyot-Sionnest <dermoth@aei.ca>2010-11-30 23:57:04 -0500
commitc49fed07c3837fb7590bd05d192d6b6f6c4ae5d4 (patch)
tree568936fcb453f6a00b96462cc987b93b0ea32158 /plugins/tests/check_snmp.t
parent5a2814a21bff07b87a7589ef19b63c9eecb8be9f (diff)
downloadmonitoring-plugins-c49fed07c3837fb7590bd05d192d6b6f6c4ae5d4.tar.gz
Fix minor test issues
My Test::More wouldn't print the total number of tests anymore, moving the plan at the top appears to fix it. At the same time I made check-http.t eval the special modules so it can skip the tests instead of failing.
Diffstat (limited to 'plugins/tests/check_snmp.t')
-rwxr-xr-xplugins/tests/check_snmp.t14
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t
index c960f7b1..b978a859 100755
--- a/plugins/tests/check_snmp.t
+++ b/plugins/tests/check_snmp.t
@@ -8,6 +8,7 @@ use Test::More;
8use NPTest; 8use NPTest;
9use FindBin qw($Bin); 9use FindBin qw($Bin);
10 10
11my $tests = 39;
11# Check that all dependent modules are available 12# Check that all dependent modules are available
12eval { 13eval {
13 require NetSNMP::OID; 14 require NetSNMP::OID;
@@ -17,6 +18,12 @@ eval {
17 18
18if ($@) { 19if ($@) {
19 plan skip_all => "Missing required module for test: $@"; 20 plan skip_all => "Missing required module for test: $@";
21} else {
22 if (-x "./check_snmp") {
23 plan tests => $tests;
24 } else {
25 plan skip_all => "No check_snmp compiled";
26 }
20} 27}
21 28
22my $port_snmp = 16100 + int(rand(100)); 29my $port_snmp = 16100 + int(rand(100));
@@ -54,13 +61,6 @@ if ($ARGV[0] && $ARGV[0] eq "-d") {
54# We should merge that with $ENV{'NPTEST_CACHE'}, use one dir for all test data 61# We should merge that with $ENV{'NPTEST_CACHE'}, use one dir for all test data
55$ENV{'NAGIOS_PLUGIN_STATE_DIRECTORY'} ||= "/var/tmp"; 62$ENV{'NAGIOS_PLUGIN_STATE_DIRECTORY'} ||= "/var/tmp";
56 63
57my $tests = 39;
58if (-x "./check_snmp") {
59 plan tests => $tests;
60} else {
61 plan skip_all => "No check_snmp compiled";
62}
63
64my $res; 64my $res;
65 65
66$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.0"); 66$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.0");