diff options
author | Aksel Sjögren <asjogren@itrsgroup.com> | 2021-04-28 13:48:20 (GMT) |
---|---|---|
committer | Jacob Hansen <jhansen@op5.com> | 2021-04-30 09:13:59 (GMT) |
commit | 5ab03a70950cecf5fe4ab52a3c4f9b0f6ac98939 (patch) | |
tree | 75e990ce0e29eea391e54f6267a1aa8d28b855fe | |
parent | 40e171b7cdb2262398728aa9b84e747a856d9c1f (diff) | |
download | monitoring-plugins-5ab03a70950cecf5fe4ab52a3c4f9b0f6ac98939.tar.gz |
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.
-rw-r--r-- | plugins/t/check_curl.t | 4 | ||||
-rw-r--r-- | 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" ); | |||
84 | like( $res->output, '/CURLOPT_URL: http:\/\/'.$host_tcp_http.':80\//ms', "Url OK" ); | 84 | like( $res->output, '/CURLOPT_URL: http:\/\/'.$host_tcp_http.':80\//ms', "Url OK" ); |
85 | 85 | ||
86 | SKIP: { | 86 | SKIP: { |
87 | skip "No internet access", 3 if $internet_access eq "no"; | 87 | skip "No internet access", 4 if $internet_access eq "no"; |
88 | 88 | ||
89 | $res = NPTest->testCmd("./$plugin -v -H $host_tls_http -S"); | 89 | $res = NPTest->testCmd("./$plugin -v -H $host_tls_http -S"); |
90 | like( $res->output, '/^Host: '.$host_tls_http.'\s*$/ms', "Host Header OK" ); | 90 | like( $res->output, '/^Host: '.$host_tls_http.'\s*$/ms', "Host Header OK" ); |
@@ -120,7 +120,7 @@ SKIP: { | |||
120 | cmp_ok( $res->return_code, "==", 0, "And also when not found"); | 120 | cmp_ok( $res->return_code, "==", 0, "And also when not found"); |
121 | } | 121 | } |
122 | SKIP: { | 122 | SKIP: { |
123 | skip "No internet access", 16 if $internet_access eq "no"; | 123 | skip "No internet access", 28 if $internet_access eq "no"; |
124 | 124 | ||
125 | $res = NPTest->testCmd( | 125 | $res = NPTest->testCmd( |
126 | "./$plugin --ssl $host_tls_http" | 126 | "./$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: { | |||
103 | cmp_ok( $res->return_code, "==", 0, "And also when not found"); | 103 | cmp_ok( $res->return_code, "==", 0, "And also when not found"); |
104 | } | 104 | } |
105 | SKIP: { | 105 | SKIP: { |
106 | skip "No internet access", 16 if $internet_access eq "no"; | 106 | skip "No internet access", 23 if $internet_access eq "no"; |
107 | 107 | ||
108 | $res = NPTest->testCmd( | 108 | $res = NPTest->testCmd( |
109 | "./$plugin --ssl $host_tls_http" | 109 | "./$plugin --ssl $host_tls_http" |
@@ -135,7 +135,7 @@ SKIP: { | |||
135 | 135 | ||
136 | # run some certificate checks with faketime | 136 | # run some certificate checks with faketime |
137 | SKIP: { | 137 | SKIP: { |
138 | skip "No faketime binary found", 12 if !$faketime; | 138 | skip "No faketime binary found", 7 if !$faketime; |
139 | $res = NPTest->testCmd("LC_TIME=C TZ=UTC ./$plugin -C 1 $host_tls_http"); | 139 | $res = NPTest->testCmd("LC_TIME=C TZ=UTC ./$plugin -C 1 $host_tls_http"); |
140 | like($res->output, qr/OK - Certificate '$host_tls_cert' will expire on/, "Catch cert output"); | 140 | like($res->output, qr/OK - Certificate '$host_tls_cert' will expire on/, "Catch cert output"); |
141 | is( $res->return_code, 0, "Catch cert output exit code" ); | 141 | is( $res->return_code, 0, "Catch cert output exit code" ); |