From 95dd5b7fbf176de300c29cdf3f122cf4a9a1fdd9 Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Fri, 19 Jul 2024 09:42:42 +0100 Subject: [PATCH] Test Runner: Catch Net::ReadTimeout when retrying actions --- elasticsearch-api/api-spec-testing/test_file.rb | 1 + .../spec/elasticsearch/api/perform_request_spec.rb | 2 +- elasticsearch/spec/integration/opentelemetry_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/elasticsearch-api/api-spec-testing/test_file.rb b/elasticsearch-api/api-spec-testing/test_file.rb index c610b918ff..41d97a775a 100644 --- a/elasticsearch-api/api-spec-testing/test_file.rb +++ b/elasticsearch-api/api-spec-testing/test_file.rb @@ -162,6 +162,7 @@ def run_actions_and_retry(actions) action.execute(client) true rescue Elastic::Transport::Transport::Errors::RequestTimeout, + Net::ReadTimeout, # TODO: Replace this if we change adapters Elastic::Transport::Transport::Errors::ServiceUnavailable => e # The action sometimes gets the cluster in a recovering state, so we # retry a few times and then raise an exception if it's still diff --git a/elasticsearch-api/spec/elasticsearch/api/perform_request_spec.rb b/elasticsearch-api/spec/elasticsearch/api/perform_request_spec.rb index 840866ea9b..a075ce257d 100644 --- a/elasticsearch-api/spec/elasticsearch/api/perform_request_spec.rb +++ b/elasticsearch-api/spec/elasticsearch/api/perform_request_spec.rb @@ -58,7 +58,7 @@ if defined_path_parts.empty? { endpoint: spec.endpoint_name } else - { endpoint: spec.endpoint_name, defined_params: defined_path_parts} + { endpoint: spec.endpoint_name, defined_params: defined_path_parts } end end diff --git a/elasticsearch/spec/integration/opentelemetry_spec.rb b/elasticsearch/spec/integration/opentelemetry_spec.rb index 57761a9aaf..55c423b780 100644 --- a/elasticsearch/spec/integration/opentelemetry_spec.rb +++ b/elasticsearch/spec/integration/opentelemetry_spec.rb @@ -36,12 +36,12 @@ end after do - client.delete(index: 'myindex', id: 1); rescue + client.delete(index: 'myindex', id: 1); rescue end context 'when a request is instrumented' do it 'sets the span name to the endpoint id' do - client.search(body: { query: { match: {a: 1} } }) + client.search(body: { query: { match: { a: 1 } } }) expect(span.name).to eq 'search' end