Skip to content

Fix flaky search_results spec

Terri Chu requested to merge 491081-fix-flaky-spec into master

What does this MR do and why?

Related to #491081 (closed)

Spec failures on master can be quickly reproduced with this subset of tests (thanks rspec --bisect!)

bundle exec rspec './ee/spec/lib/gitlab/elastic/search_results_spec.rb[1:5:4,1:5:5,1:5:6]' --seed 4145 -f d

This fixes a flaky few specs in ee/spec/lib/gitlab/elastic/search_results_spec.rb

The issue started happening when search_issues_uses_work_items_index was introduced, but the actual problem was the specs were not written to match how the code works.

The specs were setting public_and_internal_projects to false when initializing the class and performing a global search. Global search in EE with advanced search always sets this value to true.

The failure occurred because the routing was being set for requests because public_and_internal_projects was set to false

This MR changes the specs to use the default value (true) for public_and_internal_projects and updated results expectations to include public project results.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

specs only

Edited by Terri Chu

Merge request reports

Loading