diff options
author | Sven Nierlein <sven@consol.de> | 2024-07-23 19:09:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-23 19:09:21 (GMT) |
commit | 562deb749af3943dfcb6582ffcf48afb0b27e074 (patch) | |
tree | d0406ecb6d12955fec2a354ed27a23aab490692d /plugins/t/check_swap.t | |
parent | f29785f5035e489576d2ba74be774273b73dd149 (diff) | |
parent | ea104fa400acfa017e9d7690dea19edef787421f (diff) | |
download | monitoring-plugins-562deb749af3943dfcb6582ffcf48afb0b27e074.tar.gz |
Merge branch 'master' into check_curl_featuresrefs/pull/2006/head
Diffstat (limited to 'plugins/t/check_swap.t')
-rw-r--r-- | plugins/t/check_swap.t | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/t/check_swap.t b/plugins/t/check_swap.t index de9e0f0..1878038 100644 --- a/plugins/t/check_swap.t +++ b/plugins/t/check_swap.t | |||
@@ -5,7 +5,7 @@ | |||
5 | # | 5 | # |
6 | 6 | ||
7 | use strict; | 7 | use strict; |
8 | use Test::More tests => 8; | 8 | use Test::More tests => 14; |
9 | use NPTest; | 9 | use NPTest; |
10 | 10 | ||
11 | my $successOutput = '/^SWAP OK - [0-9]+\% free \([0-9]+MB out of [0-9]+MB\)/'; | 11 | my $successOutput = '/^SWAP OK - [0-9]+\% free \([0-9]+MB out of [0-9]+MB\)/'; |
@@ -14,6 +14,10 @@ my $warnOutput = '/^SWAP WARNING - [0-9]+\% free \([0-9]+MB out of [0-9]+MB\) | |||
14 | 14 | ||
15 | my $result; | 15 | my $result; |
16 | 16 | ||
17 | $result = NPTest->testCmd( "./check_swap" ); # Always OK | ||
18 | cmp_ok( $result->return_code, "==", 0, "Always OK" ); | ||
19 | like( $result->output, $successOutput, "Right output" ); | ||
20 | |||
17 | $result = NPTest->testCmd( "./check_swap -w 1048576 -c 1048576" ); # 1 MB free | 21 | $result = NPTest->testCmd( "./check_swap -w 1048576 -c 1048576" ); # 1 MB free |
18 | cmp_ok( $result->return_code, "==", 0, "At least 1MB free" ); | 22 | cmp_ok( $result->return_code, "==", 0, "At least 1MB free" ); |
19 | like( $result->output, $successOutput, "Right output" ); | 23 | like( $result->output, $successOutput, "Right output" ); |
@@ -29,3 +33,11 @@ like( $result->output, $failureOutput, "Right output" ); | |||
29 | $result = NPTest->testCmd( "./check_swap -w 100% -c 1%" ); # 100% (always warn) | 33 | $result = NPTest->testCmd( "./check_swap -w 100% -c 1%" ); # 100% (always warn) |
30 | cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' ); | 34 | cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' ); |
31 | like( $result->output, $warnOutput, "Right output" ); | 35 | like( $result->output, $warnOutput, "Right output" ); |
36 | |||
37 | $result = NPTest->testCmd( "./check_swap -w 100%" ); # 100% (single threshold, always warn) | ||
38 | cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' ); | ||
39 | like( $result->output, $warnOutput, "Right output" ); | ||
40 | |||
41 | $result = NPTest->testCmd( "./check_swap -c 100%" ); # 100% (single threshold, always critical) | ||
42 | cmp_ok( $result->return_code, "==", 2, 'Get critical because not 100% free' ); | ||
43 | like( $result->output, $failureOutput, "Right output" ); | ||