summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
-rw-r--r--plugins/t/check_dummy.t55
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 0000000..aaa7a41
--- /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
8use strict;
9use Test::More;
10use NPTest;
11
12plan tests => 20;
13
14my $res;
15
16$res = NPTest->testCmd("./check_dummy");
17is( $res->return_code, 3, "No args" );
18like( $res->output, "/Could not parse arguments/", "Correct usage message");
19
20$res = NPTest->testCmd("./check_dummy 0");
21is( $res->return_code, 0, "OK state returned");
22is( $res->output, "OK", "Says 'OK'");
23
24$res = NPTest->testCmd("./check_dummy 0 'some random data'");
25is( $res->return_code, 0, "Still OK");
26is( $res->output, "OK: some random data", "Sample text okay");
27
28$res = NPTest->testCmd("./check_dummy 1");
29is( $res->return_code, 1, "Warning okay");
30is( $res->output, "WARNING", "Says 'WARNING'");
31
32$res = NPTest->testCmd("./check_dummy 1 'more stuff'");
33is( $res->return_code, 1, "Still warning");
34is( $res->output, "WARNING: more stuff", "optional text okay" );
35
36$res = NPTest->testCmd("./check_dummy 2");
37is( $res->return_code, 2, "Critical ok" );
38is( $res->output, "CRITICAL", "Says 'CRITICAL'");
39
40$res = NPTest->testCmd("./check_dummy 2 'roughly drafted'");
41is( $res->return_code, 2, "Still critical");
42is( $res->output, "CRITICAL: roughly drafted", "optional text okay" );
43
44$res = NPTest->testCmd("./check_dummy 3");
45is( $res->return_code, 3, "Unknown ok" );
46is( $res->output, "UNKNOWN", "Says 'UNKNOWN'");
47
48$res = NPTest->testCmd("./check_dummy 3 'daringfireball'");
49is( $res->return_code, 3, "Still unknown");
50is( $res->output, "UNKNOWN: daringfireball", "optional text okay" );
51
52$res = NPTest->testCmd("./check_dummy 4");
53is( $res->return_code, 3, "Invalid error code" );
54is( $res->output, "UNKNOWN: Status 4 is not a supported error state", "With appropriate error message");
55