diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-10-31 01:50:46 +0100 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-10-31 01:50:46 +0100 |
commit | d9a999de7b182a6dd257f8b6d83067070f51e4c3 (patch) | |
tree | e2756cf238ea710fbc4989d7ccbb26dc7fe845c6 /plugins/t/check_users.t | |
parent | cff821257bebdbfba87d183726ea9672625c2e77 (diff) | |
download | monitoring-plugins-d9a999de7b182a6dd257f8b6d83067070f51e4c3.tar.gz |
Enhance tests to check wheter the option validation works
Diffstat (limited to 'plugins/t/check_users.t')
-rw-r--r-- | plugins/t/check_users.t | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/t/check_users.t b/plugins/t/check_users.t index 9ebc2fc6..21c3e53d 100644 --- a/plugins/t/check_users.t +++ b/plugins/t/check_users.t | |||
@@ -13,10 +13,11 @@ use Test; | |||
13 | use NPTest; | 13 | use NPTest; |
14 | 14 | ||
15 | use vars qw($tests); | 15 | use vars qw($tests); |
16 | BEGIN {$tests = 8; plan tests => $tests} | 16 | BEGIN {$tests = 12; plan tests => $tests} |
17 | 17 | ||
18 | my $successOutput = '/^USERS OK - [0-9]+ users currently logged in/'; | 18 | my $successOutput = '/^USERS OK - [0-9]+ users currently logged in/'; |
19 | my $failureOutput = '/^USERS CRITICAL - [0-9]+ users currently logged in/'; | 19 | my $failureOutput = '/^USERS CRITICAL - [0-9]+ users currently logged in/'; |
20 | my $wrongOptionOutput = '/Usage:/'; | ||
20 | 21 | ||
21 | my $t; | 22 | my $t; |
22 | 23 | ||
@@ -24,6 +25,8 @@ $t += checkCmd( "./check_users 1000 1000", 0, $successOutput ); | |||
24 | $t += checkCmd( "./check_users 0 0", 2, $failureOutput ); | 25 | $t += checkCmd( "./check_users 0 0", 2, $failureOutput ); |
25 | $t += checkCmd( "./check_users -w 0:1000 -c 0:1000", 0, $successOutput ); | 26 | $t += checkCmd( "./check_users -w 0:1000 -c 0:1000", 0, $successOutput ); |
26 | $t += checkCmd( "./check_users -w 0:0 -c 0:0", 2, $failureOutput ); | 27 | $t += checkCmd( "./check_users -w 0:0 -c 0:0", 2, $failureOutput ); |
28 | $t += checkCmd( "./check_users -w 0:1000", 3, $wrongOptionOutput); | ||
29 | $t += checkCmd( "./check_users", 3, $wrongOptionOutput); | ||
27 | 30 | ||
28 | exit(0) if defined($Test::Harness::VERSION); | 31 | exit(0) if defined($Test::Harness::VERSION); |
29 | exit($tests - $t); | 32 | exit($tests - $t); |