[monitoring-plugins] Remove check_swap tests with one-line format

Lorenz Kästle git at monitoring-plugins.org
Fri Feb 21 14:40:12 CET 2025


 Module: monitoring-plugins
 Branch: master
 Commit: 7c8c9d9b3e7bb6c29d82788d05d74e3f18f01aa5
 Author: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>
   Date: Fri Feb 21 13:40:09 2025 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=7c8c9d9b

Remove check_swap tests with one-line format

---

 plugins/t/check_swap.t | 39 ++-------------------------------------
 1 file changed, 2 insertions(+), 37 deletions(-)

diff --git a/plugins/t/check_swap.t b/plugins/t/check_swap.t
index 93e481c3..7e61b766 100644
--- a/plugins/t/check_swap.t
+++ b/plugins/t/check_swap.t
@@ -6,47 +6,12 @@
 
 use strict;
 use warnings;
-use Test::More tests => 35;
+use Test::More tests => 21;
 use NPTest;
 use JSON;
 
-my $successOutput = '/^OK.* - [0-9]+\% free \([0-9]+MiB out of [0-9]+MiB\)/';
-my $failureOutput = '/^CRITICAL: .*- [0-9]+\% free \([0-9]+MiB out of [0-9]+MiB\)/';
-my $warnOutput    = '/^WARNING: .*- [0-9]+\% free \([0-9]+MiB out of [0-9]+MiB\)/';
-
-my $outputFormat = '--output-format one-line';
 my $result;
-
-$result = NPTest->testCmd( "./check_swap $outputFormat" );					# Always OK
-cmp_ok( $result->return_code, "==", 0, "Always OK" );
-like( $result->output, $successOutput, "Right output" );
-
-$result = NPTest->testCmd( "./check_swap -w 1048576 -c 1048576 $outputFormat" );		# 1 MB free
-cmp_ok( $result->return_code, "==", 0, "At least 1MB free" );
-like( $result->output, $successOutput, "Right output" );
-
-$result = NPTest->testCmd( "./check_swap -w 1% -c 1% $outputFormat" );			# 1% free
-cmp_ok( $result->return_code, "==", 0, 'At least 1% free' );
-like( $result->output, $successOutput, "Right output" );
-
-$result = NPTest->testCmd( "./check_swap -w 100% -c 100% $outputFormat" );			# 100% (always critical)
-cmp_ok( $result->return_code, "==", 2, 'Get critical because not 100% free' );
-like( $result->output, $failureOutput, "Right output" );
-
-$result = NPTest->testCmd( "./check_swap -w 100% -c 1% $outputFormat" );			# 100% (always warn)
-cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' );
-like( $result->output, $warnOutput, "Right output" );
-
-$result = NPTest->testCmd( "./check_swap -w 100% $outputFormat" );				# 100% (single threshold, always warn)
-cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' );
-like( $result->output, $warnOutput, "Right output" );
-
-$result = NPTest->testCmd( "./check_swap -c 100% $outputFormat" );				# 100% (single threshold, always critical)
-cmp_ok( $result->return_code, "==", 2, 'Get critical because not 100% free' );
-like( $result->output, $failureOutput, "Right output" );
-
-
-$outputFormat = '--output-format mp-test-json';
+my $outputFormat = '--output-format mp-test-json';
 my $output;
 my $message = '/^[0-9]+\% free \([0-9]+MiB out of [0-9]+MiB\)/';
 



More information about the Commits mailing list