about summary refs log tree commit homepage
path: root/t/oob_gc.ru
diff options
context:
space:
mode:
Diffstat (limited to 't/oob_gc.ru')
-rw-r--r--t/oob_gc.ru21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/oob_gc.ru b/t/oob_gc.ru
new file mode 100644
index 0000000..c6035b6
--- /dev/null
+++ b/t/oob_gc.ru
@@ -0,0 +1,21 @@
+#\-E none
+require 'unicorn/oob_gc'
+use Rack::ContentLength
+use Rack::ContentType, "text/plain"
+use Unicorn::OobGC
+$gc_started = false
+
+# Mock GC.start
+def GC.start
+  ObjectSpace.each_object(BasicSocket) do |x|
+    next if Unicorn::HttpServer::LISTENERS.include?(x)
+    x.closed? or abort "not closed #{x}"
+  end
+  $gc_started = true
+end
+run lambda { |env|
+  if "/gc_reset" == env["PATH_INFO"] && "POST" == env["REQUEST_METHOD"]
+    $gc_started = false
+  end
+  [ 200, {}, [ "#$gc_started\n" ] ]
+}