summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
-rw-r--r--plugins/t/check_udp.t10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/t/check_udp.t b/plugins/t/check_udp.t
index c9228ad..ac1a893 100644
--- a/plugins/t/check_udp.t
+++ b/plugins/t/check_udp.t
@@ -38,10 +38,11 @@ SKIP: {
38 like ( $res->output, '/\[barbar\]/', "Output OK"); 38 like ( $res->output, '/\[barbar\]/', "Output OK");
39 close NC; 39 close NC;
40 40
41 my $pid = open(NC, "nc -l -p 3333 -u |"); # Start up a udp server listening on port 3333 41 # Start up a udp server listening on port 3333, quit after 3 seconds
42 alarm(7); 42 # Otherwise will hang at close
43 sleep 1; 43 my $pid = open(NC, "nc -l -p 3333 -u -w 3 </dev/null |");
44 $SIG{ALRM} = sub { kill 'INT', $pid }; 44 sleep 1; # Allow nc to startup
45
45 my $start = time; 46 my $start = time;
46 $res = NPTest->testCmd( "./check_udp2 -H localhost -p 3333 -s foofoo -e barbar -t 5 -4" ); 47 $res = NPTest->testCmd( "./check_udp2 -H localhost -p 3333 -s foofoo -e barbar -t 5 -4" );
47 my $duration = time - $start; 48 my $duration = time - $start;
@@ -49,7 +50,6 @@ SKIP: {
49 like ( $res->output, '/Socket timeout after 5 seconds/', "Timeout message"); 50 like ( $res->output, '/Socket timeout after 5 seconds/', "Timeout message");
50 cmp_ok( $duration, '==', 5, "Timeout exactly right"); 51 cmp_ok( $duration, '==', 5, "Timeout exactly right");
51 my $read_nc = <NC>; 52 my $read_nc = <NC>;
52 # nc gets killed here - I think expects a linefeed from stdin, so doesn't exit itself
53 close NC; 53 close NC;
54 cmp_ok( $read_nc, 'eq', "foofoo", "Data received correctly" ); 54 cmp_ok( $read_nc, 'eq', "foofoo", "Data received correctly" );
55} 55}