diff options
Diffstat (limited to 'plugins/t')
| -rw-r--r-- | plugins/t/check_ntp.t | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/t/check_ntp.t b/plugins/t/check_ntp.t index a36a730d..e7eb0c41 100644 --- a/plugins/t/check_ntp.t +++ b/plugins/t/check_ntp.t | |||
| @@ -9,8 +9,8 @@ use strict; | |||
| 9 | use Test::More; | 9 | use Test::More; |
| 10 | use NPTest; | 10 | use NPTest; |
| 11 | 11 | ||
| 12 | my @PLUGINS1 = ('check_ntp', 'check_ntpd', 'check_time_ntp'); | 12 | my @PLUGINS1 = ('check_ntp', 'check_ntp_peer', 'check_ntp_time'); |
| 13 | my @PLUGINS2 = ('check_ntp', 'check_ntpd'); | 13 | my @PLUGINS2 = ('check_ntp_peer'); |
| 14 | 14 | ||
| 15 | plan tests => (9 * scalar(@PLUGINS1)) + (6 * scalar(@PLUGINS2)); | 15 | plan tests => (9 * scalar(@PLUGINS1)) + (6 * scalar(@PLUGINS2)); |
| 16 | 16 | ||
| @@ -45,19 +45,19 @@ foreach my $plugin (@PLUGINS1) { | |||
| 45 | $res = NPTest->testCmd( | 45 | $res = NPTest->testCmd( |
| 46 | "./$plugin -H $ntp_service -w 1000 -c 2000" | 46 | "./$plugin -H $ntp_service -w 1000 -c 2000" |
| 47 | ); | 47 | ); |
| 48 | cmp_ok( $res->return_code, '==', 0, "Got good NTP result"); | 48 | cmp_ok( $res->return_code, '==', 0, "$plugin: Got good NTP result"); |
| 49 | like( $res->output, $ntp_okmatch1, "Output OK" ); | 49 | like( $res->output, $ntp_okmatch1, "Output OK" ); |
| 50 | 50 | ||
| 51 | $res = NPTest->testCmd( | 51 | $res = NPTest->testCmd( |
| 52 | "./$plugin -H $ntp_service -w 1000: -c 2000" | 52 | "./$plugin -H $ntp_service -w 1000: -c 2000" |
| 53 | ); | 53 | ); |
| 54 | cmp_ok( $res->return_code, '==', 1, "Got warning NTP result"); | 54 | cmp_ok( $res->return_code, '==', 1, "$plugin: Got warning NTP result"); |
| 55 | like( $res->output, $ntp_warnmatch1, "Output WARNING" ); | 55 | like( $res->output, $ntp_warnmatch1, "Output WARNING" ); |
| 56 | 56 | ||
| 57 | $res = NPTest->testCmd( | 57 | $res = NPTest->testCmd( |
| 58 | "./$plugin -H $ntp_service -w 1000 -c 2000:" | 58 | "./$plugin -H $ntp_service -w 1000 -c 2000:" |
| 59 | ); | 59 | ); |
| 60 | cmp_ok( $res->return_code, '==', 2, "Got critical NTP result"); | 60 | cmp_ok( $res->return_code, '==', 2, "$plugin: Got critical NTP result"); |
| 61 | like( $res->output, $ntp_critmatch1, "Output CRITICAL" ); | 61 | like( $res->output, $ntp_critmatch1, "Output CRITICAL" ); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| @@ -66,18 +66,18 @@ foreach my $plugin (@PLUGINS1) { | |||
| 66 | $res = NPTest->testCmd( | 66 | $res = NPTest->testCmd( |
| 67 | "./$plugin -H $no_ntp_service" | 67 | "./$plugin -H $no_ntp_service" |
| 68 | ); | 68 | ); |
| 69 | cmp_ok( $res->return_code, '==', 2, "Got bad NTP result"); | 69 | cmp_ok( $res->return_code, '==', 2, "$plugin: Got bad NTP result"); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | $res = NPTest->testCmd( | 72 | $res = NPTest->testCmd( |
| 73 | "./$plugin -H $host_nonresponsive" | 73 | "./$plugin -H $host_nonresponsive" |
| 74 | ); | 74 | ); |
| 75 | cmp_ok( $res->return_code, '==', 2, "Got critical if server not responding"); | 75 | cmp_ok( $res->return_code, '==', 2, "$plugin: Got critical if server not responding"); |
| 76 | 76 | ||
| 77 | $res = NPTest->testCmd( | 77 | $res = NPTest->testCmd( |
| 78 | "./$plugin -H $hostname_invalid" | 78 | "./$plugin -H $hostname_invalid" |
| 79 | ); | 79 | ); |
| 80 | cmp_ok( $res->return_code, '==', 3, "Got critical if server hostname invalid"); | 80 | cmp_ok( $res->return_code, '==', 3, "$plugin: Got critical if server hostname invalid"); |
| 81 | 81 | ||
| 82 | } | 82 | } |
| 83 | 83 | ||
| @@ -87,19 +87,19 @@ foreach my $plugin (@PLUGINS2) { | |||
| 87 | $res = NPTest->testCmd( | 87 | $res = NPTest->testCmd( |
| 88 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k 200000" | 88 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k 200000" |
| 89 | ); | 89 | ); |
| 90 | cmp_ok( $res->return_code, '==', 0, "Got good NTP result"); | 90 | cmp_ok( $res->return_code, '==', 0, "$plugin: Got good NTP result"); |
| 91 | like( $res->output, $ntp_okmatch2, "Output OK" ); | 91 | like( $res->output, $ntp_okmatch2, "Output OK" ); |
| 92 | 92 | ||
| 93 | $res = NPTest->testCmd( | 93 | $res = NPTest->testCmd( |
| 94 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W ~:-1 -C 21 -j 100000 -k 200000" | 94 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W ~:-1 -C 21 -j 100000 -k 200000" |
| 95 | ); | 95 | ); |
| 96 | cmp_ok( $res->return_code, '==', 1, "Got warning NTP result"); | 96 | cmp_ok( $res->return_code, '==', 1, "$plugin: Got warning NTP result"); |
| 97 | like( $res->output, $ntp_warnmatch2, "Output WARNING" ); | 97 | like( $res->output, $ntp_warnmatch2, "Output WARNING" ); |
| 98 | 98 | ||
| 99 | $res = NPTest->testCmd( | 99 | $res = NPTest->testCmd( |
| 100 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k ~:-1" | 100 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k ~:-1" |
| 101 | ); | 101 | ); |
| 102 | cmp_ok( $res->return_code, '==', 2, "Got critical NTP result"); | 102 | cmp_ok( $res->return_code, '==', 2, "$plugin: Got critical NTP result"); |
| 103 | like( $res->output, $ntp_critmatch2, "Output CRITICAL" ); | 103 | like( $res->output, $ntp_critmatch2, "Output CRITICAL" ); |
| 104 | } | 104 | } |
| 105 | } | 105 | } |
