about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-03-29 18:10:14 -0700
committerEric Wong <normalperson@yhbt.net>2009-03-29 20:59:44 -0700
commitdf58b5249c3e17ee4fab448224e3f043a2444fa0 (patch)
tree4ff14e4a8590d0487dc230d34fa50f518c8df8a3 /test
parentf65783b5a107fb515b46b17998b276d0fafd4be1 (diff)
downloadunicorn-df58b5249c3e17ee4fab448224e3f043a2444fa0.tar.gz
We still need to support "listeners" for easy use of
command-line options, but folks using the config file should use
"listen" as it is more flexible.
Diffstat (limited to 'test')
-rw-r--r--test/exec/test_exec.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb
index 5f91dc5..271ae20 100644
--- a/test/exec/test_exec.rb
+++ b/test/exec/test_exec.rb
@@ -112,7 +112,7 @@ end
     pid_file = "#{@tmpdir}/test.pid"
     old_file = "#{pid_file}.oldbin"
     ucfg = Tempfile.new('unicorn_test_config')
-    ucfg.syswrite("listeners %w(#{@addr}:#{@port})\n")
+    ucfg.syswrite("listen %(#@addr:#@port)\n")
     ucfg.syswrite("pid %(#{pid_file})\n")
     ucfg.syswrite("logger Logger.new(%(#{@tmpdir}/log))\n")
     pid = xfork do
@@ -155,7 +155,8 @@ end
     # fix the bug
     ucfg.sysseek(0)
     ucfg.truncate(0)
-    ucfg.syswrite("listeners %w(#{@addr}:#{@port} #{@addr}:#{port2})\n")
+    ucfg.syswrite("listen %(#@addr:#@port)\n")
+    ucfg.syswrite("listen %(#@addr:#{port2})\n")
     ucfg.syswrite("pid %(#{pid_file})\n")
     Process.kill(:USR2, current_pid)
     wait_for_file(old_file)
@@ -234,19 +235,16 @@ end
     end
   end
 
-  def test_unicorn_config_listeners_overrides_cli
-    port2 = unused_port(@addr)
+  def test_unicorn_config_listen_with_options
     File.open("config.ru", "wb") { |fp| fp.syswrite(HI) }
-    # listeners = [ ... ]  => should _override_ command-line options
     ucfg = Tempfile.new('unicorn_test_config')
-    ucfg.syswrite("listeners %w(#{@addr}:#{@port})\n")
+    ucfg.syswrite("listen '#{@addr}:#{@port}', :backlog => 512,\n")
+    ucfg.syswrite("                            :rcvbuf => 4096,\n")
+    ucfg.syswrite("                            :sndbuf => 4096\n")
     pid = xfork do
-      redirect_test_io do
-        exec($unicorn_bin, "-c#{ucfg.path}", "-l#{@addr}:#{port2}")
-      end
+      redirect_test_io { exec($unicorn_bin, "-c#{ucfg.path}") }
     end
     results = retry_hit(["http://#{@addr}:#{@port}/"])
-    assert_raises(Errno::ECONNREFUSED) { TCPSocket.new(@addr, port2) }
     assert_equal String, results[0].class
     assert_shutdown(pid)
   end