Code

Fix minor test issues
[nagiosplug.git] / plugins / tests / check_snmp.t
index c960f7b189ca183da67320d4fa0983f26992d9f3..b978a8591cc881007209950c1312d7de6eee4f17 100755 (executable)
@@ -8,6 +8,7 @@ use Test::More;
 use NPTest;
 use FindBin qw($Bin);
 
+my $tests = 39;
 # Check that all dependent modules are available
 eval {
        require NetSNMP::OID;
@@ -17,6 +18,12 @@ eval {
 
 if ($@) {
        plan skip_all => "Missing required module for test: $@";
+} else {
+       if (-x "./check_snmp") {
+               plan tests => $tests;
+       } else {
+               plan skip_all => "No check_snmp compiled";
+       }
 }
 
 my $port_snmp = 16100 + int(rand(100));
@@ -54,13 +61,6 @@ if ($ARGV[0] && $ARGV[0] eq "-d") {
 # We should merge that with $ENV{'NPTEST_CACHE'}, use one dir for all test data
 $ENV{'NAGIOS_PLUGIN_STATE_DIRECTORY'} ||= "/var/tmp";
 
-my $tests = 39;
-if (-x "./check_snmp") {
-       plan tests => $tests;
-} else {
-       plan skip_all => "No check_snmp compiled";
-}
-
 my $res;
 
 $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");