diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2007-09-21 23:01:28 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2007-09-21 23:01:28 +0000 |
commit | 8a39526e1b8754a8b8fbb50f7f6806af4def7baa (patch) | |
tree | c80f8ddafe75a920cdcec549e30e728bb57125f9 /plugins/t/negate.pl | |
parent | 7a7052512953e6626edf8efc87664dba3ee01d74 (diff) | |
download | monitoring-plugins-8a39526e1b8754a8b8fbb50f7f6806af4def7baa.tar.gz |
Stop double expansion of parameters for negate - works like
time command now
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1784 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/t/negate.pl')
-rw-r--r-- | plugins/t/negate.pl | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/plugins/t/negate.pl b/plugins/t/negate.pl deleted file mode 100644 index 6c56d4f4..00000000 --- a/plugins/t/negate.pl +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | #! /usr/bin/perl -w -I .. | ||
2 | # | ||
3 | # negate checks | ||
4 | # Need check_dummy to work for testing | ||
5 | # | ||
6 | # $Id$ | ||
7 | # | ||
8 | |||
9 | use strict; | ||
10 | use Test::More; | ||
11 | use NPTest; | ||
12 | |||
13 | plan tests => 40; | ||
14 | |||
15 | my $res; | ||
16 | |||
17 | $res = NPTest->testCmd( "./negate" ); | ||
18 | is( $res->return_code, 3, "Not enough parameters"); | ||
19 | like( $res->output, "/Could not parse arguments/", "Could not parse arguments"); | ||
20 | |||
21 | $res = NPTest->testCmd( "./negate ./check_dummy 0 'a dummy okay'" ); | ||
22 | is( $res->return_code, 2, "OK changed to CRITICAL" ); | ||
23 | is( $res->output, "OK: a dummy okay" ); | ||
24 | |||
25 | $res = NPTest->testCmd( "./negate './check_dummy 0 redsweaterblog'"); | ||
26 | is( $res->return_code, 2, "OK => CRIT with a single quote for command to run" ); | ||
27 | is( $res->output, "OK: redsweaterblog" ); | ||
28 | |||
29 | $res = NPTest->testCmd( "./negate ./check_dummy 1 'a warn a day keeps the managers at bay'" ); | ||
30 | is( $res->return_code, 2, "WARN stays same" ); | ||
31 | |||
32 | $res = NPTest->testCmd( "./negate ./check_dummy 3 mysterious"); | ||
33 | is( $res->return_code, 3, "UNKNOWN stays same" ); | ||
34 | |||
35 | my %state = ( | ||
36 | ok => 0, | ||
37 | warning => 1, | ||
38 | critical => 2, | ||
39 | unknown => 3, | ||
40 | ); | ||
41 | foreach my $current_state (qw(ok warning critical unknown)) { | ||
42 | foreach my $new_state (qw(ok warning critical unknown)) { | ||
43 | $res = NPTest->testCmd( "./negate --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" ); | ||
44 | is( $res->return_code, $state{$new_state}, "Got fake $new_state" ); | ||
45 | is( $res->output, uc($current_state).": Fake $new_state" ); | ||
46 | } | ||
47 | } | ||
48 | |||