[monitoring-plugins] Enhance tests to check wheter the option ...

RincewindsHat git at monitoring-plugins.org
Sun Nov 12 02:40:12 CET 2023


 Module: monitoring-plugins
 Branch: master
 Commit: d9a999de7b182a6dd257f8b6d83067070f51e4c3
 Author: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com>
   Date: Tue Oct 31 01:50:46 2023 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=d9a999d

Enhance tests to check wheter the option validation works

---

 plugins/t/check_users.t | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/t/check_users.t b/plugins/t/check_users.t
index 9ebc2fc..21c3e53 100644
--- a/plugins/t/check_users.t
+++ b/plugins/t/check_users.t
@@ -13,10 +13,11 @@ use Test;
 use NPTest;
 
 use vars qw($tests);
-BEGIN {$tests = 8; plan tests => $tests}
+BEGIN {$tests = 12; plan tests => $tests}
 
 my $successOutput = '/^USERS OK - [0-9]+ users currently logged in/';
 my $failureOutput = '/^USERS CRITICAL - [0-9]+ users currently logged in/';
+my $wrongOptionOutput = '/Usage:/';
 
 my $t;
 
@@ -24,6 +25,8 @@ $t += checkCmd( "./check_users 1000 1000", 0, $successOutput );
 $t += checkCmd( "./check_users    0    0", 2, $failureOutput );
 $t += checkCmd( "./check_users -w 0:1000 -c 0:1000", 0, $successOutput );
 $t += checkCmd( "./check_users -w 0:0 -c 0:0", 2, $failureOutput );
+$t += checkCmd( "./check_users -w 0:1000", 3, $wrongOptionOutput);
+$t += checkCmd( "./check_users", 3, $wrongOptionOutput);
 
 exit(0) if defined($Test::Harness::VERSION);
 exit($tests - $t);



More information about the Commits mailing list