about summary refs log tree commit homepage
path: root/t/heartbeat-timeout.ru
diff options
context:
space:
mode:
Diffstat (limited to 't/heartbeat-timeout.ru')
-rw-r--r--t/heartbeat-timeout.ru13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/heartbeat-timeout.ru b/t/heartbeat-timeout.ru
new file mode 100644
index 0000000..fff0c40
--- /dev/null
+++ b/t/heartbeat-timeout.ru
@@ -0,0 +1,13 @@
+use Rack::ContentLength
+fifo = ENV['FIFO_PATH'] or abort "FIFO_PATH not defined"
+headers = { 'Content-Type' => 'text/plain' }
+run lambda { |env|
+  case env['PATH_INFO']
+  when "/block-forever"
+    # this should block forever (or until somebody opens it for reading)
+    File.open(fifo, "rb") { |fp| fp.syswrite("NEVER\n") }
+    [ 500, headers, [ "Should never get here\n" ] ]
+  else
+    [ 200, headers, [ "#$$\n" ] ]
+  end
+}