diff options
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/check_dummy.t | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/plugins/t/check_dummy.t b/plugins/t/check_dummy.t new file mode 100644 index 00000000..aaa7a410 --- /dev/null +++ b/plugins/t/check_dummy.t | |||
@@ -0,0 +1,55 @@ | |||
1 | #! /usr/bin/perl -w -I .. | ||
2 | # | ||
3 | # check_dummy tests | ||
4 | # | ||
5 | # $Id$ | ||
6 | # | ||
7 | |||
8 | use strict; | ||
9 | use Test::More; | ||
10 | use NPTest; | ||
11 | |||
12 | plan tests => 20; | ||
13 | |||
14 | my $res; | ||
15 | |||
16 | $res = NPTest->testCmd("./check_dummy"); | ||
17 | is( $res->return_code, 3, "No args" ); | ||
18 | like( $res->output, "/Could not parse arguments/", "Correct usage message"); | ||
19 | |||
20 | $res = NPTest->testCmd("./check_dummy 0"); | ||
21 | is( $res->return_code, 0, "OK state returned"); | ||
22 | is( $res->output, "OK", "Says 'OK'"); | ||
23 | |||
24 | $res = NPTest->testCmd("./check_dummy 0 'some random data'"); | ||
25 | is( $res->return_code, 0, "Still OK"); | ||
26 | is( $res->output, "OK: some random data", "Sample text okay"); | ||
27 | |||
28 | $res = NPTest->testCmd("./check_dummy 1"); | ||
29 | is( $res->return_code, 1, "Warning okay"); | ||
30 | is( $res->output, "WARNING", "Says 'WARNING'"); | ||
31 | |||
32 | $res = NPTest->testCmd("./check_dummy 1 'more stuff'"); | ||
33 | is( $res->return_code, 1, "Still warning"); | ||
34 | is( $res->output, "WARNING: more stuff", "optional text okay" ); | ||
35 | |||
36 | $res = NPTest->testCmd("./check_dummy 2"); | ||
37 | is( $res->return_code, 2, "Critical ok" ); | ||
38 | is( $res->output, "CRITICAL", "Says 'CRITICAL'"); | ||
39 | |||
40 | $res = NPTest->testCmd("./check_dummy 2 'roughly drafted'"); | ||
41 | is( $res->return_code, 2, "Still critical"); | ||
42 | is( $res->output, "CRITICAL: roughly drafted", "optional text okay" ); | ||
43 | |||
44 | $res = NPTest->testCmd("./check_dummy 3"); | ||
45 | is( $res->return_code, 3, "Unknown ok" ); | ||
46 | is( $res->output, "UNKNOWN", "Says 'UNKNOWN'"); | ||
47 | |||
48 | $res = NPTest->testCmd("./check_dummy 3 'daringfireball'"); | ||
49 | is( $res->return_code, 3, "Still unknown"); | ||
50 | is( $res->output, "UNKNOWN: daringfireball", "optional text okay" ); | ||
51 | |||
52 | $res = NPTest->testCmd("./check_dummy 4"); | ||
53 | is( $res->return_code, 3, "Invalid error code" ); | ||
54 | is( $res->output, "UNKNOWN: Status 4 is not a supported error state", "With appropriate error message"); | ||
55 | |||