Elasticsearch Delete by query before examples
What does this MR do?
Related to #325719 (closed)
Add a new Rspec test helper that only creates/deletes the indexes at the start of the context
. The Elasticsearch API DeleteByQuery is used to delete all data in Elasticsearch before each example instead. This is done by using delete_by_query
with a match_all
query (with 5 slices, and instructing ES to proceed on conflicts)
Before
- ee/spec/services/search/global_service_spec.rb: 2188.1423042750002
- ee/spec/services/search/group_service_spec.rb: 2122.4184179000003
- ee/spec/services/search/project_service_spec.rb: 1955.100622246
- ee/spec/services/search/snippet_service_spec.rb: 337.0130661719995
After
- ee/spec/services/search/global_service_spec.rb: 913.0082140049999
- ee/spec/services/search/group_service_spec.rb: 985.0923684649988
- ee/spec/services/search/project_service_spec.rb: 956.9252228980004
- ee/spec/services/search/snippet_service_spec.rb: 83.09271206999983
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because this is a developer facing, spec only change.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Terri Chu