From 23f42e97f2cb28b3df86f0adc144a38dbf6cfd28 Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Wed, 24 Jan 2024 11:06:20 +0000 Subject: [PATCH] Dump sql on failure to track flakey test --- test/unit/execution_test.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/unit/execution_test.rb b/test/unit/execution_test.rb index c0c5d35..0b541c3 100644 --- a/test/unit/execution_test.rb +++ b/test/unit/execution_test.rb @@ -68,7 +68,9 @@ def test_active_record_instrumention_expiry instrumented_cache = lookup_store(expiry_batch_size: 2) uninstrumented_cache = lookup_store(active_record_instrumentation: false, expiry_batch_size: 2) calls = 0 + sql = [] callback = ->(*args) { + sql << args[-1][:sql] calls += 1 } @@ -101,6 +103,9 @@ def test_active_record_instrumention_expiry wait_for_background_tasks(instrumented_cache) end end + rescue Exception + puts sql.join("\n") + raise end unless ENV["NO_CONNECTS_TO"]