diff options
author | Matthias Eble <psychotrahe@users.sourceforge.net> | 2007-04-28 21:57:17 (GMT) |
---|---|---|
committer | Matthias Eble <psychotrahe@users.sourceforge.net> | 2007-04-28 21:57:17 (GMT) |
commit | 14dd02c058bc34b7b47c31556b7cacaa4ea0942b (patch) | |
tree | 273dee934748a53fcf5950a729bb4fbc4b57cd84 /plugins | |
parent | b9b27ab2552b5a236b4b422ad686388d8b31c54b (diff) | |
download | monitoring-plugins-14dd02c058bc34b7b47c31556b7cacaa4ea0942b.tar.gz |
added test cases for check_cluster
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1702 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/t/check_cluster.t | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/plugins/t/check_cluster.t b/plugins/t/check_cluster.t new file mode 100644 index 0000000..f3e78b8 --- /dev/null +++ b/plugins/t/check_cluster.t | |||
@@ -0,0 +1,83 @@ | |||
1 | #! /usr/bin/perl -w -I .. | ||
2 | # | ||
3 | # check_cluster tests | ||
4 | # | ||
5 | # $Id$ | ||
6 | # | ||
7 | |||
8 | use strict; | ||
9 | use Test::More tests => 15; | ||
10 | use NPTest; | ||
11 | |||
12 | my $result; | ||
13 | |||
14 | $result = NPTest->testCmd( | ||
15 | "./check_cluster -s -w 0:0 -c 0:0 -d 0,0,0,0" | ||
16 | ); | ||
17 | cmp_ok( $result->return_code, '==', 0, "Exit OK if non-ok services are inside critical and warning ranges" ); | ||
18 | like( $result->output, qr/service/i, "Output contains the word 'service' (case insensitive)"); | ||
19 | |||
20 | $result = NPTest->testCmd( | ||
21 | "./check_cluster -l LABEL -s -w 0:0 -c 0:0 -d 0,0,0,0" | ||
22 | ); | ||
23 | like( $result->output, qr/LABEL/, "Output contains the defined label 'LABEL' (case sensitive)"); | ||
24 | |||
25 | $result = NPTest->testCmd( | ||
26 | "./check_cluster -s -w 0:0 -c 0:1 -d 0,0,0,1" | ||
27 | ); | ||
28 | cmp_ok( $result->return_code, '==', 1, "Exit WARNING if non-ok services are inside critical and outside warning ranges" ); | ||
29 | |||
30 | $result = NPTest->testCmd( | ||
31 | "./check_cluster -s -w 0:0 -c 0:1 -d 0,0,1,1" | ||
32 | ); | ||
33 | cmp_ok( $result->return_code, '==', 2, "Exit CRITICAL if non-ok services are inside critical and outside warning ranges" ); | ||
34 | |||
35 | $result = NPTest->testCmd( | ||
36 | "./check_cluster -s -w 0 -c 0 -d 0,0,0,0" | ||
37 | ); | ||
38 | cmp_ok( $result->return_code, '==', 0, "Exit OK if non-ok services are inside critical and warning (no ranges)" ); | ||
39 | |||
40 | $result = NPTest->testCmd( | ||
41 | "./check_cluster -s -w 0 -c 1 -d 0,0,1,0" | ||
42 | ); | ||
43 | cmp_ok( $result->return_code, '==', 1, "Exit WARNING if number of non-ok services exceed warning (no ranges)" ); | ||
44 | |||
45 | $result = NPTest->testCmd( | ||
46 | "./check_cluster -s -w 0 -c 1 -d 0,0,1,1" | ||
47 | ); | ||
48 | cmp_ok( $result->return_code, '==', 2, "Exit Critical if non-ok services exceed critical warning (no ranges)" ); | ||
49 | |||
50 | |||
51 | # | ||
52 | # And for hosts.. | ||
53 | # | ||
54 | $result = NPTest->testCmd( | ||
55 | "./check_cluster -h -w 0:0 -c 0:0 -d 0,0,0,0" | ||
56 | ); | ||
57 | cmp_ok( $result->return_code, '==', 0, "Exit OK if non-ok hosts are inside critical and warning ranges" ); | ||
58 | like( $result->output, qr/host/i, "Output contains the word 'host' (case insensitive)"); | ||
59 | |||
60 | $result = NPTest->testCmd( | ||
61 | "./check_cluster -h -w 0:0 -c 0:1 -d 0,0,0,1" | ||
62 | ); | ||
63 | cmp_ok( $result->return_code, '==', 1, "Exit WARNING if non-ok hosts are inside critical and outside warning ranges" ); | ||
64 | |||
65 | $result = NPTest->testCmd( | ||
66 | "./check_cluster -h -w 0:0 -c 0:1 -d 0,0,1,1" | ||
67 | ); | ||
68 | cmp_ok( $result->return_code, '==', 2, "Exit CRITICAL if non-ok hosts are inside critical and outside warning ranges" ); | ||
69 | |||
70 | $result = NPTest->testCmd( | ||
71 | "./check_cluster -h -w 0 -c 0 -d 0,0,0,0" | ||
72 | ); | ||
73 | cmp_ok( $result->return_code, '==', 0, "Exit OK if non-ok hosts are inside critical and warning (no ranges)" ); | ||
74 | |||
75 | $result = NPTest->testCmd( | ||
76 | "./check_cluster -h -w 0 -c 1 -d 0,0,1,0" | ||
77 | ); | ||
78 | cmp_ok( $result->return_code, '==', 1, "Exit WARNING if number of non-ok hosts exceed warning (no ranges)" ); | ||
79 | |||
80 | $result = NPTest->testCmd( | ||
81 | "./check_cluster -h -w 0 -c 1 -d 0,0,1,1" | ||
82 | ); | ||
83 | cmp_ok( $result->return_code, '==', 2, "Exit Critical if non-ok hosts exceed critical warning (no ranges)" ); | ||