Skip to content

Commit 223c0df

Browse files
Add a test
1 parent c376023 commit 223c0df

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/blocking_activity_logger_test.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ def test_blocking_activity_logger_filtered
1717
refute_includes calls, 'BEGIN; SELECT 1 FROM users'
1818
end
1919

20+
def test_doenot_fail_with_unknown_start_time
21+
@migration = simulate_blocking_transaction_from_another_connection
22+
23+
alternate_connection = SafePgMigrations.alternate_connection
24+
SafePgMigrations.stubs(:alternate_connection).returns(alternate_connection)
25+
alternate_connection.stubs(:query).returns([[1234, 'SELECT something FROM a_table', nil]])
26+
27+
calls = record_calls(@migration, :write) do
28+
run_migration
29+
end.join
30+
31+
assert_match(/Query with pid 1234 started \(unknown start time\)/, calls)
32+
end
33+
2034
def test_logger_unfiltered
2135
@migration = simulate_blocking_transaction_from_another_connection
2236
calls = record_calls(@migration, :write) { run_migration }.join

0 commit comments

Comments
 (0)