summaryrefslogtreecommitdiffstats
path: root/plugins/t/check_udp.t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t/check_udp.t')
-rw-r--r--plugins/t/check_udp.t12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/t/check_udp.t b/plugins/t/check_udp.t
index c22aeaf..e8a1e39 100644
--- a/plugins/t/check_udp.t
+++ b/plugins/t/check_udp.t
@@ -13,19 +13,19 @@ my $res;
13 13
14plan tests => 14; 14plan tests => 14;
15 15
16$res = NPTest->testCmd( "./check_udp2 -H localhost -p 3333" ); 16$res = NPTest->testCmd( "./check_udp -H localhost -p 3333" );
17cmp_ok( $res->return_code, '==', 3, "Need send/expect string"); 17cmp_ok( $res->return_code, '==', 3, "Need send/expect string");
18like ( $res->output, '/With UDP checks, a send/expect string must be specified./', "Output OK"); 18like ( $res->output, '/With UDP checks, a send/expect string must be specified./', "Output OK");
19 19
20$res = NPTest->testCmd( "./check_udp2 -H localhost -p 3333 -s send" ); 20$res = NPTest->testCmd( "./check_udp -H localhost -p 3333 -s send" );
21cmp_ok( $res->return_code, '==', 3, "Need expect string"); 21cmp_ok( $res->return_code, '==', 3, "Need expect string");
22like ( $res->output, '/With UDP checks, a send/expect string must be specified./', "Output OK"); 22like ( $res->output, '/With UDP checks, a send/expect string must be specified./', "Output OK");
23 23
24$res = NPTest->testCmd( "./check_udp2 -H localhost -p 3333 -e expect" ); 24$res = NPTest->testCmd( "./check_udp -H localhost -p 3333 -e expect" );
25cmp_ok( $res->return_code, '==', 3, "Need send string"); 25cmp_ok( $res->return_code, '==', 3, "Need send string");
26like ( $res->output, '/With UDP checks, a send/expect string must be specified./', "Output OK"); 26like ( $res->output, '/With UDP checks, a send/expect string must be specified./', "Output OK");
27 27
28$res = NPTest->testCmd( "./check_udp2 -H localhost -p 3333 -s foo -e bar" ); 28$res = NPTest->testCmd( "./check_udp -H localhost -p 3333 -s foo -e bar" );
29cmp_ok( $res->return_code, '==', 2, "Errors correctly because no udp service running" ); 29cmp_ok( $res->return_code, '==', 2, "Errors correctly because no udp service running" );
30like ( $res->output, '/No data received from host/', "Output OK"); 30like ( $res->output, '/No data received from host/', "Output OK");
31 31
@@ -33,7 +33,7 @@ SKIP: {
33 skip "No netcat available", 6 unless (system("which nc > /dev/null") == 0); 33 skip "No netcat available", 6 unless (system("which nc > /dev/null") == 0);
34 open (NC, "echo 'barbar' | nc -l -p 3333 -u |"); 34 open (NC, "echo 'barbar' | nc -l -p 3333 -u |");
35 sleep 1; 35 sleep 1;
36 $res = NPTest->testCmd( "./check_udp2 -H localhost -p 3333 -s '' -e barbar -4" ); 36 $res = NPTest->testCmd( "./check_udp -H localhost -p 3333 -s '' -e barbar -4" );
37 cmp_ok( $res->return_code, '==', 0, "Got barbar response back" ); 37 cmp_ok( $res->return_code, '==', 0, "Got barbar response back" );
38 like ( $res->output, '/\[barbar\]/', "Output OK"); 38 like ( $res->output, '/\[barbar\]/', "Output OK");
39 close NC; 39 close NC;
@@ -44,7 +44,7 @@ SKIP: {
44 sleep 1; # Allow nc to startup 44 sleep 1; # Allow nc to startup
45 45
46 my $start = time; 46 my $start = time;
47 $res = NPTest->testCmd( "./check_udp2 -H localhost -p 3333 -s foofoo -e barbar -t 5 -4" ); 47 $res = NPTest->testCmd( "./check_udp -H localhost -p 3333 -s foofoo -e barbar -t 5 -4" );
48 my $duration = time - $start; 48 my $duration = time - $start;
49 cmp_ok( $res->return_code, '==', '2', "Hung waiting for response"); 49 cmp_ok( $res->return_code, '==', '2', "Hung waiting for response");
50 like ( $res->output, '/Socket timeout after 5 seconds/', "Timeout message"); 50 like ( $res->output, '/Socket timeout after 5 seconds/', "Timeout message");