From a9bfa55f9a1d1c96d73367d3bb46f7b9e81fbbf9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 14 Mar 2011 16:38:58 -0700 Subject: linux: unix_listener_stats may scan all paths This matches behavior of the TCP version. --- test/test_linux.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test') diff --git a/test/test_linux.rb b/test/test_linux.rb index d3c8da7..45dc2e0 100644 --- a/test/test_linux.rb +++ b/test/test_linux.rb @@ -39,6 +39,26 @@ class TestLinux < Test::Unit::TestCase assert_equal 1, stats[tmp.path].queued end + def test_unix_all + tmp = Tempfile.new("\xde\xad\xbe\xef") # valid path, really :) + File.unlink(tmp.path) + us = UNIXServer.new(tmp.path) + uc0 = UNIXSocket.new(tmp.path) + stats = unix_listener_stats + assert_equal 0, stats[tmp.path].active + assert_equal 1, stats[tmp.path].queued + + uc1 = UNIXSocket.new(tmp.path) + stats = unix_listener_stats + assert_equal 0, stats[tmp.path].active + assert_equal 2, stats[tmp.path].queued + + ua0 = us.accept + stats = unix_listener_stats + assert_equal 1, stats[tmp.path].active + assert_equal 1, stats[tmp.path].queued + end + def test_tcp s = TCPServer.new(TEST_ADDR, 0) port = s.addr[1] -- cgit v1.2.3-24-ge0c7