blob: d69614bd79508fb62b41e70c247aa99ff34ac450 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  | 
# frozen_string_literal: true
require "abstract_unit"
class DebugLocksTest < ActionDispatch::IntegrationTest
  setup do
    build_app
  end
  def test_render_threads_status
    thread_ready = Concurrent::CountDownLatch.new
    test_terminated = Concurrent::CountDownLatch.new
    thread = Thread.new do
      ActiveSupport::Dependencies.interlock.running do
        thread_ready.count_down
        test_terminated.wait
      end
    end
    thread_ready.wait
    get "/rails/locks"
    test_terminated.count_down
    assert_match(/Thread.*?Sharing/, @response.body)
  ensure
    thread.join
  end
  private
    def build_app
      @app = self.class.build_app do |middleware|
        middleware.use ActionDispatch::DebugLocks
      end
    end
end
 
  |