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

Merge branch 'mark_obsolete-20240410193847--add-embedding-to-issues' into 'master'

No related branches found
No related tags found
无相关合并请求
...@@ -7,6 +7,6 @@ milestone: '17.0' ...@@ -7,6 +7,6 @@ milestone: '17.0'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/149209 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/149209
skippable: true skippable: true
skip_condition: Must be on Elasticsearch 8+ skip_condition: Must be on Elasticsearch 8+
obsolete: false obsolete: true
marked_obsolete_by_url: marked_obsolete_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169314
marked_obsolete_in_milestone: marked_obsolete_in_milestone: '17.6'
...@@ -23,3 +23,5 @@ def new_mappings ...@@ -23,3 +23,5 @@ def new_mappings
} }
end end
end end
AddEmbeddingToIssues.prepend ::Elastic::MigrationObsolete
...@@ -64,7 +64,6 @@ def hybrid_issue_search? ...@@ -64,7 +64,6 @@ def hybrid_issue_search?
return false unless Feature.enabled?(:search_issues_hybrid_search) return false unless Feature.enabled?(:search_issues_hybrid_search)
return false unless Feature.enabled?(:ai_global_switch, type: :ops) return false unless Feature.enabled?(:ai_global_switch, type: :ops)
return false unless Gitlab::Saas.feature_available?(:ai_vertex_embeddings) return false unless Gitlab::Saas.feature_available?(:ai_vertex_embeddings)
return false unless ::Elastic::DataMigrationService.migration_has_finished?(:add_embedding_to_issues)
project = Project.id_in(options[:project_ids])&.first project = Project.id_in(options[:project_ids])&.first
user = options[:current_user] user = options[:current_user]
......
...@@ -4,65 +4,5 @@ ...@@ -4,65 +4,5 @@
require File.expand_path('ee/elastic/migrate/20240410193847_add_embedding_to_issues.rb') require File.expand_path('ee/elastic/migrate/20240410193847_add_embedding_to_issues.rb')
RSpec.describe AddEmbeddingToIssues, feature_category: :global_search do RSpec.describe AddEmbeddingToIssues, feature_category: :global_search do
let(:version) { 20240410193847 } it_behaves_like 'a deprecated Advanced Search migration', 20240410193847
let(:migration) { described_class.new(version) }
let(:helper) { Gitlab::Elastic::Helper.default }
before do
allow(Gitlab::Elastic::Helper).to receive(:default).and_return(helper)
allow(migration).to receive(:helper).and_return(helper)
end
describe 'migration', :elastic, :sidekiq_inline do
before do
skip 'migration is skipped' if migration.skip_migration?
end
describe '.migrate' do
describe 'migration process' do
before do
allow(helper).to receive(:get_mapping).and_return({})
end
it 'updates the issues index mappings' do
expect(helper).to receive(:update_mapping)
migration.migrate
end
end
end
describe '.completed?' do
context 'when mapping has not been updated' do
before do
allow(helper).to receive(:get_mapping).and_return({})
end
specify { expect(migration).not_to be_completed }
end
end
end
describe 'skip_migration?' do
before do
allow(helper).to receive(:vectors_supported?).and_return(vectors_supported)
described_class.skip_if -> { !helper.vectors_supported?(:elasticsearch) }
end
context 'if vectors are supported' do
let(:vectors_supported) { true }
it 'returns false' do
expect(migration.skip_migration?).to be_falsey
end
end
context 'if vectors are not supported' do
let(:vectors_supported) { false }
it 'returns true' do
expect(migration.skip_migration?).to be_truthy
end
end
end
end end
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
require File.expand_path('ee/elastic/migrate/20240410193847_add_embedding_to_issues.rb')
RSpec.describe 'Elastic Ingestion Pipeline', :sidekiq_inline, feature_category: :global_search do RSpec.describe 'Elastic Ingestion Pipeline', :sidekiq_inline, feature_category: :global_search do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
......
...@@ -95,8 +95,6 @@ ...@@ -95,8 +95,6 @@
allow(user).to receive(:any_group_with_ai_available?).and_return(true) allow(user).to receive(:any_group_with_ai_available?).and_return(true)
allow(Gitlab::Llm::VertexAi::Embeddings::Text).to receive(:new).and_return(embedding_service) allow(Gitlab::Llm::VertexAi::Embeddings::Text).to receive(:new).and_return(embedding_service)
allow(embedding_service).to receive(:execute).and_return(mock_embedding) allow(embedding_service).to receive(:execute).and_return(mock_embedding)
allow(::Elastic::DataMigrationService).to receive(:migration_has_finished?)
.with(:add_embedding_to_issues).and_return(true)
end end
shared_examples 'without hybrid search query' do shared_examples 'without hybrid search query' do
...@@ -158,8 +156,6 @@ ...@@ -158,8 +156,6 @@
stub_feature_flags(ai_global_switch: ai_global_switch) stub_feature_flags(ai_global_switch: ai_global_switch)
stub_feature_flags(elasticsearch_issue_embedding: issue_embedding) stub_feature_flags(elasticsearch_issue_embedding: issue_embedding)
allow(Gitlab::Saas).to receive(:feature_available?).and_return(ai_available) allow(Gitlab::Saas).to receive(:feature_available?).and_return(ai_available)
allow(::Elastic::DataMigrationService).to receive(:migration_has_finished?)
.with(:add_embedding_to_issues).and_return(migration_done)
end end
it_behaves_like 'without hybrid search query' it_behaves_like 'without hybrid search query'
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册