about summary refs log tree commit homepage
path: root/test/test_linux.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-06-12 18:29:00 -0700
committerEric Wong <normalperson@yhbt.net>2012-06-12 18:29:00 -0700
commit5c62376bc9a1b0d7c8e664784a1fb97747a7c392 (patch)
tree4f1fe250ca670465dc9576e9a73b3ce79105394f /test/test_linux.rb
parent506df98df1dae59281fbb3b3c2c6bea7549a2288 (diff)
downloadraindrops-5c62376bc9a1b0d7c8e664784a1fb97747a7c392.tar.gz
When unix_listener_stats is called without arguments, it should
still match the behavior of tcp_listener_stats and return
ListenerStats object with zero values.

This allows callers to iterate through the results to find the
pathnames of all the Unix domain sockets in in listen mode.
Diffstat (limited to 'test/test_linux.rb')
-rw-r--r--test/test_linux.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_linux.rb b/test/test_linux.rb
index a84eecf..0e79a86 100644
--- a/test/test_linux.rb
+++ b/test/test_linux.rb
@@ -67,6 +67,17 @@ class TestLinux < Test::Unit::TestCase
     assert_equal 1, stats[tmp.path].queued
   end
 
+  def test_unix_all_unused
+    tmp = Tempfile.new("\xde\xad\xbe\xef") # valid path, really :)
+    File.unlink(tmp.path)
+    us = UNIXServer.new(tmp.path)
+    stats = unix_listener_stats
+    assert stats.keys.include?(tmp.path), stats.inspect
+
+    assert_equal 0, stats[tmp.path].active
+    assert_equal 0, stats[tmp.path].queued
+  end
+
   def test_unix_resolves_symlinks
     tmp = Tempfile.new("\xde\xad\xbe\xef") # valid path, really :)
     File.unlink(tmp.path)