diff --git a/actionpack/lib/action_controller/metal/live.rb b/actionpack/lib/action_controller/metal/live.rb index 2f4c8fb83cd07..6d89b9d49abc7 100644 --- a/actionpack/lib/action_controller/metal/live.rb +++ b/actionpack/lib/action_controller/metal/live.rb @@ -141,7 +141,7 @@ def initialize(response) @cv = new_cond @aborted = false @ignore_disconnect = false - super(response, SizedQueue.new(10)) + super(response, Rails.env.test? ? Queue.new : SizedQueue.new(10)) end def write(string) diff --git a/actionpack/test/controller/live_stream_test.rb b/actionpack/test/controller/live_stream_test.rb index 431fe90b23a24..6811fd3a36393 100644 --- a/actionpack/test/controller/live_stream_test.rb +++ b/actionpack/test/controller/live_stream_test.rb @@ -330,25 +330,27 @@ def test_async_stream end def test_abort_with_full_buffer - @controller.latch = Concurrent::CountDownLatch.new - @controller.error_latch = Concurrent::CountDownLatch.new - - capture_log_output do |output| - get :overfill_buffer_and_die, format: "plain" - - t = Thread.new(response) { |resp| - resp.await_commit - _, _, body = resp.to_a - body.each do - @controller.latch.wait - body.close - break - end - } - - t.join - @controller.error_latch.wait - assert_match "Error while streaming", output.rewind && output.read + Rails.stub(:env, ActiveSupport::StringInquirer.new("production")) do + @controller.latch = Concurrent::CountDownLatch.new + @controller.error_latch = Concurrent::CountDownLatch.new + + capture_log_output do |output| + get :overfill_buffer_and_die, format: "plain" + + t = Thread.new(response) { |resp| + resp.await_commit + _, _, body = resp.to_a + body.each do + @controller.latch.wait + body.close + break + end + } + + t.join + @controller.error_latch.wait + assert_match "Error while streaming", output.rewind && output.read + end end end