about summary refs log tree commit homepage
path: root/test/test_proxy_pass.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2018-05-01 19:42:22 +0000
committerEric Wong <e@80x24.org>2018-05-01 22:26:18 +0000
commitc2a0658fc26467a3950bb2848948932ae4f33f61 (patch)
tree0e7b176bdd9a328d46d9ee68b894f32ffd5b8300 /test/test_proxy_pass.rb
parentfc10a4c09318a1402e5f9f1c770b1f772c12def0 (diff)
downloadyahns-c2a0658fc26467a3950bb2848948932ae4f33f61.tar.gz
We can't require 'proxy_pass' in both a parent and forked child,
so require it up front (as kcar will become a hard dependency
in place of unicorn).

Then, rely on GTL (global test lock) to synchronize around fork
since the VM may not always be able to protect that.

However, there's no need to synchronize around
spawn/system/`backtick`, as the VM should always be using those
in a thread-safe way (via vfork).
Diffstat (limited to 'test/test_proxy_pass.rb')
-rw-r--r--test/test_proxy_pass.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/test/test_proxy_pass.rb b/test/test_proxy_pass.rb
index 22f1802..51d0d3f 100644
--- a/test/test_proxy_pass.rb
+++ b/test/test_proxy_pass.rb
@@ -6,6 +6,7 @@ require 'json'
 require 'digest'
 begin
   require 'kcar'
+  require 'yahns/proxy_pass'
 rescue LoadError
 end
 
@@ -188,7 +189,6 @@ class TestProxyPass < Testcase
     pid = mkserver(cfg) do
       @srv.autoclose = @srv2.autoclose = false
       ENV["YAHNS_FD"] = "#{@srv.fileno},#{@srv2.fileno}"
-      require 'yahns/proxy_pass'
       cfg.instance_eval do
         app(:rack, Yahns::ProxyPass.new("unix:#{unix_path}:/$fullpath")) do
           listen "#{host}:#{port}"
@@ -251,7 +251,6 @@ class TestProxyPass < Testcase
     err, cfg, host, port = @err, Yahns::Config.new, @srv.addr[3], @srv.addr[1]
     host2, port2 = @srv2.addr[3], @srv2.addr[1]
     pid = mkserver(cfg) do
-      require 'yahns/proxy_pass'
       @srv2.close
       cfg.instance_eval do
         app(:rack, Yahns::ProxyPass.new("http://#{host2}:#{port2}")) do