diff --git a/spec/activerecord/debug_errors/ext/connection_adapters/abstract_mysql_adapter_spec.rb b/spec/activerecord/debug_errors/ext/connection_adapters/abstract_mysql_adapter_spec.rb index d76df70..e206b8e 100644 --- a/spec/activerecord/debug_errors/ext/connection_adapters/abstract_mysql_adapter_spec.rb +++ b/spec/activerecord/debug_errors/ext/connection_adapters/abstract_mysql_adapter_spec.rb @@ -71,17 +71,23 @@ def cause_deadlock(role:) context "when ActiveRecord::LockWaitTimeout occurs" do it "displays transactions and processlist" do barrier = CyclicBarrier.new(2) - + logger = Logger.new($stderr) ths = Array.new(2) do Thread.new do User.transaction do barrier.await(1) + logger.info("#{Thread.current.object_id}: #{User.connection.execute("show variables like 'innodb_lock_wait_timeout'").to_a.first.join('=')}") + logger.info("#{Thread.current.object_id}: User.lock.find_by!") User.lock.find_by!(name: 'foo') sleep 2 + logger.info("#{Thread.current.object_id}: done") end end end + ths.each.with_index do |th, i| + logger.info("ths[#{i}].object_id = #{th.object_id}") + end expect { ths.each(&:join) }.to raise_error(ActiveRecord::LockWaitTimeout)