aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/tc_mauve_udp_server.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/tc_mauve_udp_server.rb b/test/tc_mauve_udp_server.rb
index 9a82de8..ecb981e 100644
--- a/test/tc_mauve_udp_server.rb
+++ b/test/tc_mauve_udp_server.rb
@@ -20,11 +20,16 @@ class TcMauveUdpServer < Mauve::UnitTest
def test_listens
update = generic_update()
+ before = Time.now
t = Thread.new do @server.__send__(:main_loop) end
sleep(0.2)
sender.send(update)
Timeout.timeout(2) do t.join end
- assert_equal update, Proto::AlertUpdate.new.parse_from_string(Server.packet_pop[0])
+ after = Time.now
+ data, addrinfo, received_at = Server.packet_pop
+ assert_equal update, Proto::AlertUpdate.new.parse_from_string(data)
+ assert addrinfo[3], "No client source address!"
+ assert received_at >= before && received_at <= after, "Received at time was wrong"
end
def test_closes