diff options
author | Napsty <ck@claudiokuenzler.com> | 2024-04-12 13:23:58 +0200 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.org> | 2024-04-12 16:50:15 +0200 |
commit | 675f208476628af192d1fdee9eeedcc76fbc8d43 (patch) | |
tree | dd8bf44e10b42a42c53df61a21d4664ee721a5a0 /plugins | |
parent | 9b4fab066492ca4065adfdf1080086fe6ffa53c2 (diff) | |
download | monitoring-plugins-675f208476628af192d1fdee9eeedcc76fbc8d43.tar.gz |
Adjust check_swap tests
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/t/check_swap.t | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/t/check_swap.t b/plugins/t/check_swap.t index de9e0f05..f40d9ef6 100644 --- a/plugins/t/check_swap.t +++ b/plugins/t/check_swap.t | |||
@@ -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, $warnOutput, "Right output" ); | ||