Flaky Spec Fixes: Dont Assume No Elasticsearch Data, Refresh before delete_by_query (#8354)

This commit is contained in:
Molly Struve 2020-06-09 07:55:28 -05:00 committed by GitHub
parent 1bf5ea42f0
commit 9e3b6a090b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -10,6 +10,7 @@ module ElasticsearchHelpers
end
def clear_elasticsearch_data(search_class)
search_class.refresh_index
Search::Client.delete_by_query(
index: search_class::INDEX_ALIAS, body: { query: { match_all: {} } },
)

View file

@ -45,7 +45,7 @@ RSpec.describe Metrics::RecordDataCountsWorker, type: :worker do
expect(
DatadogStatsClient,
).to have_received(:gauge).with("elasticsearch.document_count", 0, tags: Array).at_least(1)
).to have_received(:gauge).with("elasticsearch.document_count", Integer, tags: Array).at_least(1)
end
end
end