From 93a718202947e7d742c8c25f326631de84b4e44e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 14 Oct 2009 18:36:05 -0700 Subject: tests: enforce rack.multithread and rainbows.model Help ensure apps get the correct Rack environment to make choices (if any) with. --- t/t1000.ru | 6 +++++- t/t2000.ru | 6 +++++- t/t3000.ru | 6 +++++- t/t4000.ru | 8 +++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/t/t1000.ru b/t/t1000.ru index e639023..4bb7348 100644 --- a/t/t1000.ru +++ b/t/t1000.ru @@ -2,5 +2,9 @@ use Rack::ContentLength use Rack::ContentType run lambda { |env| sleep 1 - [ 200, {}, [ Thread.current.inspect << "\n" ] ] + if env['rack.multithread'] && env['rainbows.model'] == :ThreadPool + [ 200, {}, [ Thread.current.inspect << "\n" ] ] + else + raise "rack.multithread is not true" + end } diff --git a/t/t2000.ru b/t/t2000.ru index e639023..aa1accb 100644 --- a/t/t2000.ru +++ b/t/t2000.ru @@ -2,5 +2,9 @@ use Rack::ContentLength use Rack::ContentType run lambda { |env| sleep 1 - [ 200, {}, [ Thread.current.inspect << "\n" ] ] + if env['rack.multithread'] && env['rainbows.model'] == :ThreadSpawn + [ 200, {}, [ Thread.current.inspect << "\n" ] ] + else + raise "rack.multithread is not true" + end } diff --git a/t/t3000.ru b/t/t3000.ru index 7053c1a..9b9c56a 100644 --- a/t/t3000.ru +++ b/t/t3000.ru @@ -2,5 +2,9 @@ use Rack::ContentLength use Rack::ContentType run lambda { |env| Actor.sleep 1 - [ 200, {}, [ Thread.current.inspect << "\n" ] ] + if env['rack.multithread'] == false && env['rainbows.model'] == :Revactor + [ 200, {}, [ Thread.current.inspect << "\n" ] ] + else + raise "rack.multithread is true" + end } diff --git a/t/t4000.ru b/t/t4000.ru index c2355da..a3e2855 100644 --- a/t/t4000.ru +++ b/t/t4000.ru @@ -1,3 +1,9 @@ use Rack::ContentLength use Rack::ContentType -run lambda { |env| [ 200, {}, [ env.inspect << "\n" ] ] } +run lambda { |env| + if env['rack.multithread'] == false && env['rainbows.model'] == :Rev + [ 200, {}, [ env.inspect << "\n" ] ] + else + raise "rack.multithread is true" + end +} -- cgit v1.2.3-24-ge0c7