1 #! /usr/bin/perl -w -I ..
15 $res = NPTest
->testCmd("./check_dummy");
16 is
( $res->return_code, 3, "No args" );
17 like
( $res->output, "/Could not parse arguments/", "Correct usage message");
19 $res = NPTest
->testCmd("./check_dummy 0");
20 is
( $res->return_code, 0, "OK state returned");
21 is
( $res->output, "OK", "Says 'OK'");
23 $res = NPTest
->testCmd("./check_dummy 0 'some random data'");
24 is
( $res->return_code, 0, "Still OK");
25 is
( $res->output, "OK: some random data", "Sample text okay");
27 $res = NPTest
->testCmd("./check_dummy 1");
28 is
( $res->return_code, 1, "Warning okay");
29 is
( $res->output, "WARNING", "Says 'WARNING'");
31 $res = NPTest
->testCmd("./check_dummy 1 'more stuff'");
32 is
( $res->return_code, 1, "Still warning");
33 is
( $res->output, "WARNING: more stuff", "optional text okay" );
35 $res = NPTest
->testCmd("./check_dummy 2");
36 is
( $res->return_code, 2, "Critical ok" );
37 is
( $res->output, "CRITICAL", "Says 'CRITICAL'");
39 $res = NPTest
->testCmd("./check_dummy 2 'roughly drafted'");
40 is
( $res->return_code, 2, "Still critical");
41 is
( $res->output, "CRITICAL: roughly drafted", "optional text okay" );
43 $res = NPTest
->testCmd("./check_dummy 3");
44 is
( $res->return_code, 3, "Unknown ok" );
45 is
( $res->output, "UNKNOWN", "Says 'UNKNOWN'");
47 $res = NPTest
->testCmd("./check_dummy 3 'daringfireball'");
48 is
( $res->return_code, 3, "Still unknown");
49 is
( $res->output, "UNKNOWN: daringfireball", "optional text okay" );
51 $res = NPTest
->testCmd("./check_dummy 4");
52 is
( $res->return_code, 3, "Invalid error code" );
53 is
( $res->output, "UNKNOWN: Status 4 is not a supported error state", "With appropriate error message");