Skip to content

Commit 58832ed

Browse files
authored
Merge pull request rails#53860 from yahonda/diag_53858
Address `ActiveRecord::InstrumentationTest#test_payload_connection_with_query_cache_enabled` failure
2 parents cd8ecdb + 2566083 commit 58832ed

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

activerecord/test/cases/instrumentation_test.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,16 @@ def test_payload_connection_with_query_cache_disabled
138138
def test_payload_connection_with_query_cache_enabled
139139
connection = ClothingItem.lease_connection
140140

141-
payloads = capture_notifications("sql.active_record") do
142-
assert_notifications_count("sql.active_record", 2) do
143-
Book.cache do
144-
Book.first
145-
Book.first
146-
end
141+
notifications = capture_notifications("sql.active_record") do
142+
Book.cache do
143+
Book.first
144+
Book.first
147145
end
148-
end.map(&:payload)
146+
end
147+
148+
payloads = notifications.select { _1.payload[:sql].match?("SELECT") }.map(&:payload)
149149

150+
assert_equal 2, payloads.size
150151
assert_equal connection, payloads.first[:connection]
151152
assert_equal connection, payloads.second[:connection]
152153
end

0 commit comments

Comments
 (0)