Skip to content
代码片段 群组 项目
未验证 提交 e7609e9c 编辑于 作者: John Mason's avatar John Mason 提交者: GitLab
浏览文件

Merge branch 'fix-search-zoekt-index' into 'master'

No related branches found
No related tags found
无相关合并请求
...@@ -23,7 +23,7 @@ def index?(container) ...@@ -23,7 +23,7 @@ def index?(container)
root_namespace_id = fetch_root_namespace_id(container) root_namespace_id = fetch_root_namespace_id(container)
return false unless root_namespace_id return false unless root_namespace_id
::Search::Zoekt::EnabledNamespace.for_root_namespace_id(root_namespace_id).exists? ::Search::Zoekt::Index.for_root_namespace_id(root_namespace_id).exists?
end end
private private
......
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
create(:zoekt_index, :ready, zoekt_enabled_namespace: enabled_namespace, node: node) create(:zoekt_index, :ready, zoekt_enabled_namespace: enabled_namespace, node: node)
end end
let_it_be(:unassigned_group) { create(:group) }
let_it_be_with_reload(:enabled_namespace_without_index) do
create(:zoekt_enabled_namespace, namespace: unassigned_group)
end
describe '#fetch_node_id' do describe '#fetch_node_id' do
subject(:fetch_node_id) { described_class.fetch_node_id(container) } subject(:fetch_node_id) { described_class.fetch_node_id(container) }
...@@ -131,7 +136,7 @@ ...@@ -131,7 +136,7 @@
it { is_expected.to eq(true) } it { is_expected.to eq(true) }
end end
context 'when Zoekt::EnabledNamespace not found' do context 'when Zoekt::Index is not found' do
let(:container) { build(:project) } let(:container) { build(:project) }
it { is_expected.to eq(false) } it { is_expected.to eq(false) }
...@@ -142,5 +147,11 @@ ...@@ -142,5 +147,11 @@
it { expect { index }.to raise_error(ArgumentError) } it { expect { index }.to raise_error(ArgumentError) }
end end
context 'when group is unassigned' do
let(:container) { unassigned_group }
it { is_expected.to eq(false) }
end
end end
end end
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
RSpec.describe ::Search::Zoekt::DefaultBranchChangedWorker, feature_category: :global_search do RSpec.describe ::Search::Zoekt::DefaultBranchChangedWorker, feature_category: :global_search do
let_it_be(:zoekt_enabled_namespace) { create(:zoekt_enabled_namespace) } let_it_be(:zoekt_enabled_namespace) { create(:zoekt_enabled_namespace) }
let_it_be(:project) { create(:project, :repository, namespace: zoekt_enabled_namespace.namespace) } let_it_be(:project) { create(:project, :repository, namespace: zoekt_enabled_namespace.namespace) }
let_it_be(:index) do
create(:zoekt_index, :ready, zoekt_enabled_namespace: zoekt_enabled_namespace, node: create(:zoekt_node))
end
let(:default_branch_changed_event) { Repositories::DefaultBranchChangedEvent.new(data: data) } let(:default_branch_changed_event) { Repositories::DefaultBranchChangedEvent.new(data: data) }
let(:container) { project } let(:container) { project }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册