From 10c98b83c4375fd0f68f8d58725963389c72c791 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal <sdungarwal@gitlab.com> Date: Thu, 24 Oct 2024 15:11:52 +0000 Subject: [PATCH] Add epic to the scope and fix the flaky spec --- ee/lib/gitlab/elastic/group_search_results.rb | 2 +- ee/spec/features/search/elastic/group_search_spec.rb | 4 +--- .../lib/gitlab/elastic/group_search_results_spec.rb | 12 ++++++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ee/lib/gitlab/elastic/group_search_results.rb b/ee/lib/gitlab/elastic/group_search_results.rb index e83c026ffb82d..2d075f072ff69 100644 --- a/ee/lib/gitlab/elastic/group_search_results.rb +++ b/ee/lib/gitlab/elastic/group_search_results.rb @@ -31,7 +31,7 @@ def scope_options(scope) case scope when :users super.except(:group_ids) # User uses group_id for namespace_query - when :wiki_blobs, :work_items + when :wiki_blobs, :work_items, :epics super.merge(root_ancestor_ids: [group.root_ancestor.id]) else super diff --git a/ee/spec/features/search/elastic/group_search_spec.rb b/ee/spec/features/search/elastic/group_search_spec.rb index c96e15150481b..07ce76276e825 100644 --- a/ee/spec/features/search/elastic/group_search_spec.rb +++ b/ee/spec/features/search/elastic/group_search_spec.rb @@ -86,15 +86,13 @@ def choose_group(group) choose_group(group) end - it 'finds epics', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/500148' do - # issues + it 'finds epics' do submit_search('chosen') select_search_scope('Epics') expect(page).to have_content('chosen epic title') end it 'finds issues' do - # issues submit_search('chosen') select_search_scope('Issues') expect(page).to have_content('chosen issue title') diff --git a/ee/spec/lib/gitlab/elastic/group_search_results_spec.rb b/ee/spec/lib/gitlab/elastic/group_search_results_spec.rb index d2843de6d3576..669bbdbfed7b2 100644 --- a/ee/spec/lib/gitlab/elastic/group_search_results_spec.rb +++ b/ee/spec/lib/gitlab/elastic/group_search_results_spec.rb @@ -498,6 +498,18 @@ end end + context ':work_items' do + it 'has root_ancestor_ids' do + expect(subject.scope_options(:work_items)).to include :root_ancestor_ids + end + end + + context ':epics' do + it 'has root_ancestor_ids' do + expect(subject.scope_options(:epics)).to include :root_ancestor_ids + end + end + context ':wiki_blobs' do it 'has root_ancestor_ids' do expect(subject.scope_options(:wiki_blobs)).to include :root_ancestor_ids -- GitLab