about summary refs log tree commit homepage
path: root/t/worker-follows-master-to-death.ru
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-06 19:45:17 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-06 19:45:17 -0800
commit1a9a718a3f9a5b582a4a339a9bb9249c2ca392d7 (patch)
tree0c95f2d8fc4de8542f7716832800614e1e7a8872 /t/worker-follows-master-to-death.ru
parente1dcadef6ca242e36e99aab19e3e040bf01070f9 (diff)
downloadrainbows-1a9a718a3f9a5b582a4a339a9bb9249c2ca392d7.tar.gz
It turns out neither the EventMachine and Rev classes
checked for master death in its heartbeat mechanism.
Since we managed to forget the same thing twice, we
now have a test case for it and also centralized the
code to remove duplication.
Diffstat (limited to 't/worker-follows-master-to-death.ru')
-rw-r--r--t/worker-follows-master-to-death.ru17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/worker-follows-master-to-death.ru b/t/worker-follows-master-to-death.ru
new file mode 100644
index 0000000..ed2a519
--- /dev/null
+++ b/t/worker-follows-master-to-death.ru
@@ -0,0 +1,17 @@
+use Rack::ContentLength
+headers = { 'Content-Type' => 'text/plain' }
+run lambda { |env|
+  /\A100-continue\z/i =~ env['HTTP_EXPECT'] and return [ 100, {}, [] ]
+  env['rack.input'].read
+
+  case env["PATH_INFO"]
+  when %r{/sleep/(\d+)}
+    (case env['rainbows.model']
+    when :Revactor
+      Actor
+    else
+      Kernel
+    end).sleep($1.to_i)
+  end
+  [ 200, headers, [ "#$$\n" ] ]
+}