From a56e6797237c9ee33aea2539a6dc8c1d76c9299a Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 21 Dec 2022 14:40:18 +0000 Subject: [PATCH] DEV: Add logging for flaky FinalDestination spec (#19548) This test occasionally fails in CI. I haven't been able to reproduce the issue locally. This logging will print some extra information when the assertion fails. --- spec/lib/final_destination/resolver_spec.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/lib/final_destination/resolver_spec.rb b/spec/lib/final_destination/resolver_spec.rb index 6d1139fa93a..bf519d843db 100644 --- a/spec/lib/final_destination/resolver_spec.rb +++ b/spec/lib/final_destination/resolver_spec.rb @@ -17,13 +17,17 @@ describe FinalDestination::Resolver do Addrinfo.stubs(:getaddrinfo).with { |addr| addr == "example.com" }.returns(mock_response) expect { - FinalDestination::Resolver.lookup("sleep.example.com", timeout: 0.001) + result = FinalDestination::Resolver.lookup("sleep.example.com", timeout: 0.001) + # If the test gets this far, it failed + puts "Flaky test debug: Result was #{result.inspect}" }.to raise_error(Timeout::Error) start_thread_count = alive_thread_count expect { - FinalDestination::Resolver.lookup("sleep.example.com", timeout: 0.001) + result = FinalDestination::Resolver.lookup("sleep.example.com", timeout: 0.001) + # If the test gets this far, it failed + puts "Flaky test debug: Result was #{result.inspect}" }.to raise_error(Timeout::Error) expect(alive_thread_count).to eq(start_thread_count)