Commit 8cdb4f0d authored by Max Woolf's avatar Max Woolf

Merge branch 'sh-fix-issue-330124' into 'master'

All specs using :elastic should clear Redis shared state

See merge request gitlab-org/gitlab!64019
parents 8fe3c9d2 cf9f772b
...@@ -871,7 +871,8 @@ at the start and end of each context only. The [Elasticsearch DeleteByQuery API] ...@@ -871,7 +871,8 @@ at the start and end of each context only. The [Elasticsearch DeleteByQuery API]
is used to delete data in all indices in between examples to ensure a clean index. is used to delete data in all indices in between examples to ensure a clean index.
Note that Elasticsearch indexing uses [`Gitlab::Redis::SharedState`](../../../ee/development/redis.md#gitlabrediscachesharedstatequeues). Note that Elasticsearch indexing uses [`Gitlab::Redis::SharedState`](../../../ee/development/redis.md#gitlabrediscachesharedstatequeues).
Therefore, it is recommended to use `:clean_gitlab_redis_shared_state` in conjunction with the Elasticsearch traits. Therefore, the Elasticsearch traits dynamically use the `:clean_gitlab_redis_shared_state` trait.
You do NOT need to add `:clean_gitlab_redis_shared_state` manually.
Specs using Elasticsearch require that you: Specs using Elasticsearch require that you:
......
...@@ -56,6 +56,10 @@ module Elastic ...@@ -56,6 +56,10 @@ module Elastic
end end
RSpec.configure do |config| RSpec.configure do |config|
config.define_derived_metadata do |meta|
meta[:clean_gitlab_redis_cache] = true if meta[:elastic] || meta[:elastic_delete_by_query]
end
config.around(:each, :elastic) do |example| config.around(:each, :elastic) do |example|
helper = Elastic::TestHelpers.new helper = Elastic::TestHelpers.new
helper.setup helper.setup
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment