diff options
Diffstat (limited to 'plugins-root/t')
| -rw-r--r-- | plugins-root/t/check_icmp.t | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/plugins-root/t/check_icmp.t b/plugins-root/t/check_icmp.t index 1a755866..98ef966d 100644 --- a/plugins-root/t/check_icmp.t +++ b/plugins-root/t/check_icmp.t | |||
| @@ -39,63 +39,54 @@ my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID", | |||
| 39 | 39 | ||
| 40 | my $res; | 40 | my $res; |
| 41 | 41 | ||
| 42 | # 1 | ||
| 43 | $res = NPTest->testCmd( | 42 | $res = NPTest->testCmd( |
| 44 | "$sudo ./check_icmp -H $host_responsive -w 10000ms,100% -c 10000ms,100%" | 43 | "$sudo ./check_icmp -H $host_responsive -w 10000ms,100% -c 10000ms,100%" |
| 45 | ); | 44 | ); |
| 46 | is( $res->return_code, 0, "Syntax ok" ); | 45 | is( $res->return_code, 0, "Syntax ok" ); |
| 47 | like( $res->output, $successOutput, "Output OK" ); | 46 | like( $res->output, $successOutput, "Output OK" ); |
| 48 | 47 | ||
| 49 | # 2 | ||
| 50 | $res = NPTest->testCmd( | 48 | $res = NPTest->testCmd( |
| 51 | "$sudo ./check_icmp -H $host_responsive -w 0ms,0% -c 10000ms,100%" | 49 | "$sudo ./check_icmp -H $host_responsive -w 0ms,0% -c 10000ms,100%" |
| 52 | ); | 50 | ); |
| 53 | is( $res->return_code, 1, "Syntax ok, with forced warning" ); | 51 | is( $res->return_code, 1, "Syntax ok, with forced warning" ); |
| 54 | like( $res->output, $failureOutput, "Output OK" ); | 52 | like( $res->output, $failureOutput, "Output OK" ); |
| 55 | 53 | ||
| 56 | # 3 | ||
| 57 | $res = NPTest->testCmd( | 54 | $res = NPTest->testCmd( |
| 58 | "$sudo ./check_icmp -H $host_responsive -w 0,0% -c 0,0%" | 55 | "$sudo ./check_icmp -H $host_responsive -w 0,0% -c 0,0%" |
| 59 | ); | 56 | ); |
| 60 | is( $res->return_code, 2, "Syntax ok, with forced critical" ); | 57 | is( $res->return_code, 2, "Syntax ok, with forced critical" ); |
| 61 | like( $res->output, $failureOutput, "Output OK" ); | 58 | like( $res->output, $failureOutput, "Output OK" ); |
| 62 | 59 | ||
| 63 | # 4 | ||
| 64 | $res = NPTest->testCmd( | 60 | $res = NPTest->testCmd( |
| 65 | "$sudo ./check_icmp -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100%" | 61 | "$sudo ./check_icmp -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100%" |
| 66 | ); | 62 | ); |
| 67 | is( $res->return_code, 2, "Timeout - host nonresponsive" ); | 63 | is( $res->return_code, 2, "Timeout - host nonresponsive" ); |
| 68 | like( $res->output, '/100%/', "Error contains '100%' string (for 100% packet loss)" ); | 64 | like( $res->output, '/100%/', "Error contains '100%' string (for 100% packet loss)" ); |
| 69 | 65 | ||
| 70 | # 4 | ||
| 71 | $res = NPTest->testCmd( | 66 | $res = NPTest->testCmd( |
| 72 | "$sudo ./check_icmp -w 10000ms,100% -c 10000ms,100%" | 67 | "$sudo ./check_icmp -w 10000ms,100% -c 10000ms,100%" |
| 73 | ); | 68 | ); |
| 74 | is( $res->return_code, 3, "No hostname" ); | 69 | is( $res->return_code, 3, "No hostname" ); |
| 75 | like( $res->output, '/No hosts to check/', "Output with appropriate error message"); | 70 | like( $res->output, '/No hosts to check/', "Output with appropriate error message"); |
| 76 | 71 | ||
| 77 | # 5 | ||
| 78 | $res = NPTest->testCmd( | 72 | $res = NPTest->testCmd( |
| 79 | "$sudo ./check_icmp -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100% -n 1 -m 0" | 73 | "$sudo ./check_icmp -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100% -n 1 -m 0" |
| 80 | ); | 74 | ); |
| 81 | is( $res->return_code, 0, "One host nonresponsive - zero required" ); | 75 | is( $res->return_code, 0, "One host nonresponsive - zero required" ); |
| 82 | like( $res->output, $successOutput, "Output OK" ); | 76 | like( $res->output, $successOutput, "Output OK" ); |
| 83 | 77 | ||
| 84 | # 6 | ||
| 85 | $res = NPTest->testCmd( | 78 | $res = NPTest->testCmd( |
| 86 | "$sudo ./check_icmp -H $host_responsive -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100% -n 1 -m 1" | 79 | "$sudo ./check_icmp -H $host_responsive -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100% -n 1 -m 1" |
| 87 | ); | 80 | ); |
| 88 | is( $res->return_code, 0, "One of two host nonresponsive - one required" ); | 81 | is( $res->return_code, 0, "One of two host nonresponsive - one required" ); |
| 89 | like( $res->output, $successOutput, "Output OK" ); | 82 | like( $res->output, $successOutput, "Output OK" ); |
| 90 | 83 | ||
| 91 | # 7 | ||
| 92 | $res = NPTest->testCmd( | 84 | $res = NPTest->testCmd( |
| 93 | "$sudo ./check_icmp -H $host_responsive -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100% -n 1 -m 2" | 85 | "$sudo ./check_icmp -H $host_responsive -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100% -n 1 -m 2" |
| 94 | ); | 86 | ); |
| 95 | is( $res->return_code, 2, "One of two host nonresponsive - two required" ); | 87 | is( $res->return_code, 2, "One of two host nonresponsive - two required" ); |
| 96 | like( $res->output, $failureOutput, "Output OK" ); | 88 | like( $res->output, $failureOutput, "Output OK" ); |
| 97 | 89 | ||
| 98 | # 8 | ||
| 99 | $res = NPTest->testCmd( | 90 | $res = NPTest->testCmd( |
| 100 | "$sudo ./check_icmp -H $host_responsive -s 127.0.15.15 -w 10000ms,100% -c 10000ms,100% -n 1 -m 2" | 91 | "$sudo ./check_icmp -H $host_responsive -s 127.0.15.15 -w 10000ms,100% -c 10000ms,100% -n 1 -m 2" |
| 101 | ); | 92 | ); |
| @@ -108,7 +99,6 @@ $res = NPTest->testCmd( | |||
| 108 | is( $res->return_code, 0, "Try max paket size" ); | 99 | is( $res->return_code, 0, "Try max paket size" ); |
| 109 | like( $res->output, $successOutput, "Output OK - Didn't overflow" ); | 100 | like( $res->output, $successOutput, "Output OK - Didn't overflow" ); |
| 110 | 101 | ||
| 111 | # 9 | ||
| 112 | $res = NPTest->testCmd( | 102 | $res = NPTest->testCmd( |
| 113 | "$sudo ./check_icmp -H ::1 -vvv" | 103 | "$sudo ./check_icmp -H ::1 -vvv" |
| 114 | ); | 104 | ); |
