diff options
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/check_disk.t | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index 70d8415c..66344927 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t | |||
@@ -52,8 +52,8 @@ if ($free_on_mp1 > $free_on_mp2) { | |||
52 | } | 52 | } |
53 | 53 | ||
54 | 54 | ||
55 | $result = NPTest->testCmd( "./check_disk -w 100 -c 100 -p $more_free" ); | 55 | $result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free" ); |
56 | cmp_ok( $result->return_code, '==', 0, "At least 100 bytes available on $more_free"); | 56 | cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free"); |
57 | like ( $result->output, $successOutput, "OK output" ); | 57 | like ( $result->output, $successOutput, "OK output" ); |
58 | 58 | ||
59 | $result = NPTest->testCmd( "./check_disk 100 100 $more_free" ); | 59 | $result = NPTest->testCmd( "./check_disk 100 100 $more_free" ); |
@@ -110,35 +110,28 @@ cmp_ok( $result->return_code, '==', 2, "And reversing arguments should not make | |||
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | |||
114 | $result = NPTest->testCmd( | ||
115 | "./check_disk -w 10% -c 15% -p $mountpoint_valid" | ||
116 | ); | ||
117 | cmp_ok( $result->return_code, '==', 3, "Invalid command line options" ); | ||
118 | |||
119 | TODO: { | 113 | TODO: { |
120 | local $TODO = "-p must come after -w and -c"; | 114 | local $TODO = "Invalid percent figures"; |
121 | $result = NPTest->testCmd( | 115 | $result = NPTest->testCmd( |
116 | "./check_disk -w 10% -c 15% -p $mountpoint_valid" | ||
117 | ); | ||
118 | cmp_ok( $result->return_code, '==', 3, "Invalid command line options" ); | ||
119 | } | ||
120 | |||
121 | $result = NPTest->testCmd( | ||
122 | "./check_disk -p $mountpoint_valid -w 10% -c 15%" | 122 | "./check_disk -p $mountpoint_valid -w 10% -c 15%" |
123 | ); | 123 | ); |
124 | cmp_ok( $result->return_code, "==", 3, "Invalid options - order unimportant" ); | 124 | cmp_ok( $result->return_code, "==", 3, "Invalid options: -p must come after thresholds" ); |
125 | } | ||
126 | 125 | ||
127 | $result = NPTest->testCmd( "./check_disk -w 100% -c 100% ".${mountpoint_valid} ); # 100% empty | 126 | $result = NPTest->testCmd( "./check_disk -w 100% -c 100% ".${mountpoint_valid} ); # 100% empty |
128 | cmp_ok( $result->return_code, "==", 2, "100% empty" ); | 127 | cmp_ok( $result->return_code, "==", 2, "100% empty" ); |
129 | like( $result->output, $failureOutput, "Right output" ); | 128 | like( $result->output, $failureOutput, "Right output" ); |
130 | 129 | ||
131 | TODO: { | 130 | $result = NPTest->testCmd( "./check_disk -w 100000 -c 100000 $mountpoint_valid" ); |
132 | local $TODO = "Requesting 100GB free is should be critical"; | 131 | cmp_ok( $result->return_code, '==', 2, "Check for 100GB free" ); |
133 | $result = NPTest->testCmd( "./check_disk -w 100000 -c 100000 $mountpoint_valid" ); | ||
134 | cmp_ok( $result->return_code, '==', 2, "Check for 100GB free" ); | ||
135 | } | ||
136 | 132 | ||
137 | TODO: { | 133 | $result = NPTest->testCmd( "./check_disk -w 100 -c 100 -u GB ".${mountpoint_valid} ); # 100 GB empty |
138 | local $TODO = "-u GB does not work"; | 134 | cmp_ok( $result->return_code, "==", 2, "100 GB empty" ); |
139 | $result = NPTest->testCmd( "./check_disk -w 100 -c 100 -u GB ".${mountpoint_valid} ); # 100 GB empty | ||
140 | cmp_ok( $result->return_code, "==", 2, "100 GB empty" ); | ||
141 | } | ||
142 | 135 | ||
143 | 136 | ||
144 | # Checking old syntax of check_disk warn crit [fs], with warn/crit at USED% thresholds | 137 | # Checking old syntax of check_disk warn crit [fs], with warn/crit at USED% thresholds |
@@ -151,17 +144,17 @@ cmp_ok( $result->return_code, '==', 0, "Old syntax: 100% used" ); | |||
151 | $result = NPTest->testCmd( "./check_disk 0 100 $mountpoint_valid" ); | 144 | $result = NPTest->testCmd( "./check_disk 0 100 $mountpoint_valid" ); |
152 | cmp_ok( $result->return_code, '==', 1, "Old syntax: warn 0% used" ); | 145 | cmp_ok( $result->return_code, '==', 1, "Old syntax: warn 0% used" ); |
153 | 146 | ||
154 | $result = NPTest->testCmd( "./check_disk 0 200 $mountpoint_valid" ); | ||
155 | cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); | ||
156 | |||
157 | TODO: { | 147 | TODO: { |
158 | local $TODO = "Need to properly check input"; | 148 | local $TODO = "Invalid values"; |
149 | $result = NPTest->testCmd( "./check_disk 0 200 $mountpoint_valid" ); | ||
150 | cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); | ||
151 | |||
159 | $result = NPTest->testCmd( "./check_disk 200 200 $mountpoint_valid" ); | 152 | $result = NPTest->testCmd( "./check_disk 200 200 $mountpoint_valid" ); |
160 | cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); | 153 | cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); |
161 | } | ||
162 | 154 | ||
163 | $result = NPTest->testCmd( "./check_disk 200 0 $mountpoint_valid" ); | 155 | $result = NPTest->testCmd( "./check_disk 200 0 $mountpoint_valid" ); |
164 | cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); | 156 | cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); |
157 | } | ||
165 | 158 | ||
166 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p /bob" ); | 159 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p /bob" ); |
167 | cmp_ok( $result->return_code, '==', 2, "Checking /bob - return error because /bob does not exist" ); | 160 | cmp_ok( $result->return_code, '==', 2, "Checking /bob - return error because /bob does not exist" ); |