Skip to content

Commit

Permalink
ES tests: retry on search_phase_execution_exception (#1665)
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal authored May 3, 2024
1 parent 717b299 commit 794e8ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flow/e2e/elasticsearch/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ func (s elasticsearchSuite) Peer() *protos.Peer {
func (s elasticsearchSuite) countDocumentsInIndex(index string) int64 {
res, err := s.esClient.Count().Index(index).Do(context.Background())
// index may not exist yet, don't error out for that
if err != nil && strings.Contains(err.Error(), "index_not_found_exception") {
return 0
// search can occasionally fail, retry for that
if err != nil && (strings.Contains(err.Error(), "index_not_found_exception") ||
strings.Contains(err.Error(), "search_phase_execution_exception")) {
return -1
}
require.NoError(s.t, err, "failed to get count of documents in index")
return res.Count
Expand Down

0 comments on commit 794e8ea

Please sign in to comment.