summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0f34287)
raw | patch | inline | side by side (parent: 0f34287)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Mon, 27 Mar 2006 08:39:28 +0000 (08:39 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Mon, 27 Mar 2006 08:39:28 +0000 (08:39 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1359 f882894a-f735-0410-b71e-b25c423dba1c
plugins/t/check_udp.t | patch | blob | history |
diff --git a/plugins/t/check_udp.t b/plugins/t/check_udp.t
index c9228adc64890064d1819120d7967dde964b1943..ac1a893c3e5d97c1febba3f8e5a6d257f578096a 100644 (file)
--- a/plugins/t/check_udp.t
+++ b/plugins/t/check_udp.t
like ( $res->output, '/\[barbar\]/', "Output OK");
close NC;
- my $pid = open(NC, "nc -l -p 3333 -u |"); # Start up a udp server listening on port 3333
- alarm(7);
- sleep 1;
- $SIG{ALRM} = sub { kill 'INT', $pid };
+ # Start up a udp server listening on port 3333, quit after 3 seconds
+ # Otherwise will hang at close
+ my $pid = open(NC, "nc -l -p 3333 -u -w 3 </dev/null |");
+ sleep 1; # Allow nc to startup
+
my $start = time;
$res = NPTest->testCmd( "./check_udp2 -H localhost -p 3333 -s foofoo -e barbar -t 5 -4" );
my $duration = time - $start;
like ( $res->output, '/Socket timeout after 5 seconds/', "Timeout message");
cmp_ok( $duration, '==', 5, "Timeout exactly right");
my $read_nc = <NC>;
- # nc gets killed here - I think expects a linefeed from stdin, so doesn't exit itself
close NC;
cmp_ok( $read_nc, 'eq', "foofoo", "Data received correctly" );
}