diff --git a/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb b/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb index 64061d7b..7ee38215 100644 --- a/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb +++ b/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb @@ -331,7 +331,8 @@ def body expect(subject.url_meta(u)[:state]).to eql(:dead) sleep subject.resurrect_delay + 1 - expect(subject.url_meta(u)[:state]).to eql(:alive) + # try a few times with exponential backoff as timing is not 100% guaranteed during CI execution. + try(10) { expect(subject.url_meta(u)[:state]).to eql(:alive) } end end end