[monitoring-plugins] Fix conditional tests for check_http, check_curl

Jacob Hansen git at monitoring-plugins.org
Fri Apr 30 11:20:10 CEST 2021


    Module: monitoring-plugins
    Branch: feature_github_actions
    Commit: 5ab03a70950cecf5fe4ab52a3c4f9b0f6ac98939
    Author: Aksel Sjögren <asjogren at itrsgroup.com>
 Committer: Jacob Hansen <jhansen at op5.com>
      Date: Wed Apr 28 15:48:20 2021 +0200
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=5ab03a7

Fix conditional tests for check_http, check_curl

Set correct number of tests in skip- blocks to avoid the error "Bad
plan.  You planned 50 tests but ran 55" when run with/without
/usr/bin/faketime and NP_INTERNET_ACCESS=yes/no.

---

 plugins/t/check_curl.t | 4 ++--
 plugins/t/check_http.t | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugins/t/check_curl.t b/plugins/t/check_curl.t
index a4f1dfb..4f4124b 100644
--- a/plugins/t/check_curl.t
+++ b/plugins/t/check_curl.t
@@ -84,7 +84,7 @@ like( $res->output, '/^Host: testhost:8001\s*$/ms', "Host Header OK" );
 like( $res->output, '/CURLOPT_URL: http:\/\/'.$host_tcp_http.':80\//ms', "Url OK" );
 
 SKIP: {
-        skip "No internet access", 3 if $internet_access eq "no";
+        skip "No internet access", 4 if $internet_access eq "no";
 
         $res = NPTest->testCmd("./$plugin -v -H $host_tls_http -S");
         like( $res->output, '/^Host: '.$host_tls_http.'\s*$/ms', "Host Header OK" );
@@ -120,7 +120,7 @@ SKIP: {
         cmp_ok( $res->return_code, "==", 0, "And also when not found");
 }
 SKIP: {
-        skip "No internet access", 16 if $internet_access eq "no";
+        skip "No internet access", 28 if $internet_access eq "no";
 
         $res = NPTest->testCmd(
                 "./$plugin --ssl $host_tls_http"
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t
index e92681e..c137f7b 100644
--- a/plugins/t/check_http.t
+++ b/plugins/t/check_http.t
@@ -103,7 +103,7 @@ SKIP: {
         cmp_ok( $res->return_code, "==", 0, "And also when not found");
 }
 SKIP: {
-        skip "No internet access", 16 if $internet_access eq "no";
+        skip "No internet access", 23 if $internet_access eq "no";
 
         $res = NPTest->testCmd(
                 "./$plugin --ssl $host_tls_http"
@@ -135,7 +135,7 @@ SKIP: {
 
         # run some certificate checks with faketime
         SKIP: {
-                skip "No faketime binary found", 12 if !$faketime;
+                skip "No faketime binary found", 7 if !$faketime;
                 $res = NPTest->testCmd("LC_TIME=C TZ=UTC ./$plugin -C 1 $host_tls_http");
                 like($res->output, qr/OK - Certificate '$host_tls_cert' will expire on/, "Catch cert output");
                 is( $res->return_code, 0, "Catch cert output exit code" );



More information about the Commits mailing list