summaryrefslogtreecommitdiffstats
path: root/plugins/t/check_swap.t
diff options
context:
space:
mode:
authorNapsty <ck@claudiokuenzler.com>2024-04-12 11:23:58 (GMT)
committerSven Nierlein <sven@nierlein.org>2024-04-12 14:50:15 (GMT)
commit675f208476628af192d1fdee9eeedcc76fbc8d43 (patch)
treedd8bf44e10b42a42c53df61a21d4664ee721a5a0 /plugins/t/check_swap.t
parent9b4fab066492ca4065adfdf1080086fe6ffa53c2 (diff)
downloadmonitoring-plugins-675f208476628af192d1fdee9eeedcc76fbc8d43.tar.gz
Adjust check_swap tests
Diffstat (limited to 'plugins/t/check_swap.t')
-rw-r--r--plugins/t/check_swap.t12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/t/check_swap.t b/plugins/t/check_swap.t
index de9e0f0..f40d9ef 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
15my $result; 15my $result;
16 16
17$result = NPTest->testCmd( "./check_swap" ); # Always OK
18cmp_ok( $result->return_code, "==", 0, "Always OK" );
19like( $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
18cmp_ok( $result->return_code, "==", 0, "At least 1MB free" ); 22cmp_ok( $result->return_code, "==", 0, "At least 1MB free" );
19like( $result->output, $successOutput, "Right output" ); 23like( $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)
30cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' ); 34cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' );
31like( $result->output, $warnOutput, "Right output" ); 35like( $result->output, $warnOutput, "Right output" );
36
37$result = NPTest->testCmd( "./check_swap -w 100%" ); # 100% (single threshold, always warn)
38cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' );
39like( $result->output, $warnOutput, "Right output" );
40
41$result = NPTest->testCmd( "./check_swap -c 100%" ); # 100% (single threshold, always critical)
42cmp_ok( $result->return_code, "==", 2, 'Get critical because not 100% free' );
43like( $result->output, $warnOutput, "Right output" );