tests: limit oobgc check to accepted sockets
[unicorn.git] / t / oob_gc_path.ru
blobaf8e3b9ef5c466ba13e843c37a1e893164be0601
1 #\-E none
2 require 'unicorn/oob_gc'
3 use Rack::ContentLength
4 use Rack::ContentType, "text/plain"
5 use Unicorn::OobGC, 5, /BAD/
6 $gc_started = false
8 # Mock GC.start
9 def GC.start
10   ObjectSpace.each_object(Kgio::Socket) do |x|
11     x.closed? or abort "not closed #{x}"
12   end
13   $gc_started = true
14 end
15 run lambda { |env|
16   if "/gc_reset" == env["PATH_INFO"] && "POST" == env["REQUEST_METHOD"]
17     $gc_started = false
18   end
19   [ 200, {}, [ "#$gc_started\n" ] ]