From 6610f5feddfd7fde38f80b079f4a8a56b5e8d947 Mon Sep 17 00:00:00 2001 From: Alex Woods Date: Mon, 26 Aug 2024 13:25:53 -0700 Subject: [PATCH] Fix flaky endpoint discovery cache test (#3093) --- .../spec/aws/plugins/endpoint_discovery_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gems/aws-sdk-core/spec/aws/plugins/endpoint_discovery_spec.rb b/gems/aws-sdk-core/spec/aws/plugins/endpoint_discovery_spec.rb index b4480ebb7e8..a6c3277c3fd 100644 --- a/gems/aws-sdk-core/spec/aws/plugins/endpoint_discovery_spec.rb +++ b/gems/aws-sdk-core/spec/aws/plugins/endpoint_discovery_spec.rb @@ -275,8 +275,12 @@ module Plugins ] } ) + cache_thread_block = nil + allow(Thread).to receive(:new) do |&block| + cache_thread_block = block + end c.operation_not_required(foo: 'foo') - sleep(0.1) + cache_thread_block.call expect(c.api_requests.size).to eq(3) c.operation_not_required(foo: 'foo') expect(c.api_requests.size).to eq(4)