summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5a2814a)
raw | patch | inline | side by side (parent: 5a2814a)
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | |
Wed, 1 Dec 2010 04:57:04 +0000 (23:57 -0500) | ||
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | |
Wed, 1 Dec 2010 04:57:04 +0000 (23:57 -0500) |
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.
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.
plugins/tests/check_http.t | patch | blob | history | |
plugins/tests/check_snmp.t | patch | blob | history |
index f03933bd39236ad29308cabacc512d73bde42d9a..74eff1758acdcd3130362fb23a2ed6f7a1baa9e6 100755 (executable)
use NPTest;
use FindBin qw($Bin);
-use HTTP::Daemon;
-use HTTP::Status;
-use HTTP::Response;
+my $common_tests = 66;
+my $ssl_only_tests = 6;
+# Check that all dependent modules are available
+eval {
+ require HTTP::Daemon;
+ require HTTP::Status;
+ require HTTP::Response;
+};
+
+if ($@) {
+ plan skip_all => "Missing required module for test: $@";
+} else {
+ if (-x "./check_http") {
+ plan tests => $common_tests * 2 + $ssl_only_tests;
+ } else {
+ plan skip_all => "No check_http compiled";
+ }
+}
my $servers = { http => 0 }; # HTTP::Daemon should always be available
eval { require HTTP::Daemon::SSL };
$c->send_response("slow");
} elsif ($r->url->path eq "/method") {
if ($r->method eq "DELETE") {
- $c->send_error(RC_METHOD_NOT_ALLOWED);
+ $c->send_error(HTTP::Status->RC_METHOD_NOT_ALLOWED);
} elsif ($r->method eq "foo") {
- $c->send_error(RC_NOT_IMPLEMENTED);
+ $c->send_error(HTTP::Status->RC_NOT_IMPLEMENTED);
} else {
$c->send_status_line(200, $r->method);
}
delete($persist[1000]);
next MAINLOOP;
} else {
- $c->send_error(RC_FORBIDDEN);
+ $c->send_error(HTTP::Status->RC_FORBIDDEN);
}
$c->close;
}
}
}
-my $common_tests = 66;
-my $ssl_only_tests = 6;
-if (-x "./check_http") {
- plan tests => $common_tests * 2 + $ssl_only_tests;
-} else {
- plan skip_all => "No check_http compiled";
-}
-
my $result;
my $command = "./check_http -H 127.0.0.1";
index c960f7b189ca183da67320d4fa0983f26992d9f3..b978a8591cc881007209950c1312d7de6eee4f17 100755 (executable)
use NPTest;
use FindBin qw($Bin);
+my $tests = 39;
# Check that all dependent modules are available
eval {
require NetSNMP::OID;
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));
# 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");