Skip to content
Snippets Groups Projects
Verified Commit d50f4f1c authored by Terri Chu's avatar Terri Chu :nail_care: Committed by GitLab
Browse files

Remove search_index_all_projects FF

Changelog: other
EE: true
parent 16c41970
No related branches found
No related tags found
1 merge request!148111Remove search_index_all_projects FF
Showing
with 97 additions and 368 deletions
---
name: search_index_all_projects
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134456
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/432489
milestone: '16.7'
type: development
group: group::global search
default_enabled: true
......@@ -399,13 +399,7 @@ from the Elasticsearch index as expected.
#### All project records are indexed
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/428070) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `search_index_all_projects`. Disabled by default.
> - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/432489) in GitLab 16.9.
> - [Enabled on self-managed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/145300) in GitLab 16.10.
FLAG:
On self-managed GitLab, by default this feature is available.
To hide the feature, an administrator can [disable the feature flag](../../administration/feature_flags.md) named `search_index_all_projects`.
On GitLab.com, this feature is available. On GitLab Dedicated, this feature is not available.
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/148111) in GitLab 16.11. Feature flag `search_index_all_projects` removed.
When you select the **Limit the amount of namespace and project data to index** checkbox:
......
......@@ -22,8 +22,6 @@ def maintaining_indexed_associations?
override :maintaining_elasticsearch?
def maintaining_elasticsearch?
return super if ::Feature.disabled?(:search_index_all_projects, root_namespace)
::Gitlab::CurrentSettings.elasticsearch_indexing?
end
......
......@@ -25,8 +25,7 @@ def index
def delete_from_index
return unless Gitlab::CurrentSettings.elasticsearch_indexing?
# do not delete the project document if indexing for all projects is enabled for the project
delete_project = ::Feature.disabled?(:search_index_all_projects, project.root_namespace)
ElasticDeleteProjectWorker.perform_async(project.id, project.es_id, delete_project: delete_project)
# project documents are indexed regardless of limit settings
ElasticDeleteProjectWorker.perform_async(project.id, project.es_id, delete_project: false)
end
end
......@@ -31,13 +31,10 @@ def perform(project_id, old_namespace_id, new_namespace_id)
delete_old_project(project, old_namespace_id)
elsif should_invalidate_elasticsearch_indexes_cache && ::Gitlab::CurrentSettings.elasticsearch_indexing?
# If the new namespace isn't indexed, the project should no longer exist in the index
# and will be deleted asynchronously. If all projects are indexed, queue the project for indexing
# If the new namespace isn't indexed, the project's associated records should no longer exist in the index
# and will be deleted asynchronously. Queue the project for indexing
# to update the namespace field and remove the old document from the index.
keep_project_in_index = ::Feature.enabled?(:search_index_all_projects, project.root_namespace)
::Elastic::ProcessInitialBookkeepingService.track!(build_document_reference(project)) if keep_project_in_index
::Elastic::ProcessInitialBookkeepingService.track!(build_document_reference(project))
delete_old_project(project, old_namespace_id)
end
......
......@@ -32,7 +32,7 @@ def perform(project_id, wiki = false, options = {})
@project = Project.find_by_id(project_id)
unless @project&.use_elasticsearch?
es_id = ::Gitlab::Elastic::Helper.build_es_id(es_type: Project.es_type, target_id: project_id)
delete_project = @project.nil? || ::Feature.disabled?(:search_index_all_projects, @project.root_namespace)
delete_project = @project.nil?
ElasticDeleteProjectWorker.perform_async(project_id, es_id, delete_project: delete_project)
return true
end
......
......@@ -50,9 +50,8 @@ def index_group_associations(namespace)
end
def delete_from_index(namespace)
delete_project = ::Feature.disabled?(:search_index_all_projects, namespace.root_ancestor)
namespace.all_projects.find_in_batches do |batch|
args = batch.map { |project| [project.id, project.es_id, { delete_project: delete_project }] }
args = batch.map { |project| [project.id, project.es_id, { delete_project: false }] }
ElasticDeleteProjectWorker.bulk_perform_async(args) # rubocop:disable Scalability/BulkPerformWithContext
end
......
......@@ -88,7 +88,7 @@ def cleanup_container_elastic_documents(container, container_id, container_type)
end
if container_type == 'Project'
delete_project = container.nil? || ::Feature.disabled?(:search_index_all_projects, container.root_namespace)
delete_project = container.nil?
ElasticDeleteProjectWorker.perform_async(
container_id,
......
......@@ -20,17 +20,7 @@
describe '#maintaining_elasticsearch?' do
subject(:maintaining_elasticsearch) { project.maintaining_elasticsearch? }
context 'when the search_index_all_projects FF is false' do
before do
stub_feature_flags(search_index_all_projects: false)
end
it { is_expected.to be(false) }
end
context 'when the search_index_all_projects FF is true' do
it { is_expected.to be(true) }
end
it { is_expected.to be(true) }
end
describe '#use_elasticsearch?' do
......@@ -48,17 +38,7 @@
describe '#maintaining_elasticsearch?' do
subject(:maintaining_elasticsearch) { project.maintaining_elasticsearch? }
context 'when the search_index_all_projects FF is false' do
before do
stub_feature_flags(search_index_all_projects: false)
end
it { is_expected.to be(true) }
end
context 'when the search_index_all_projects FF is true' do
it { is_expected.to be(true) }
end
it { is_expected.to be(true) }
end
describe '#use_elasticsearch?' do
......@@ -68,28 +48,12 @@
end
describe 'indexing', :sidekiq_inline do
context 'when the search_index_all_projects FF is false' do
before do
stub_feature_flags(search_index_all_projects: false)
end
it 'only indexes enabled projects' do
create(:project, :empty_repo, path: 'test_two', description: 'awesome project')
ensure_elasticsearch_index!
expect(described_class.elastic_search('main_project', options: { project_ids: :any }).total_count).to eq(1)
expect(described_class.elastic_search('"test_two"', options: { project_ids: :any }).total_count).to eq(0)
end
end
it 'indexes all projects' do
create(:project, :empty_repo, path: 'test_two', description: 'awesome project')
ensure_elasticsearch_index!
context 'when the search_index_all_projects FF is true' do
it 'indexes all projects' do
create(:project, :empty_repo, path: 'test_two', description: 'awesome project')
ensure_elasticsearch_index!
expect(described_class.elastic_search('main_project', options: { project_ids: :any }).total_count).to eq(1)
expect(described_class.elastic_search('"test_two"', options: { project_ids: :any }).total_count).to eq(1)
end
expect(described_class.elastic_search('main_project', options: { project_ids: :any }).total_count).to eq(1)
expect(described_class.elastic_search('"test_two"', options: { project_ids: :any }).total_count).to eq(1)
end
end
end
......@@ -106,48 +70,19 @@
subject(:maintaining_elasticsearch) { project_in_group.maintaining_elasticsearch? }
context 'when the search_index_all_projects FF is false' do
before do
stub_feature_flags(search_index_all_projects: false)
end
it { is_expected.to be(true) }
end
context 'when the search_index_all_projects FF is true' do
it { is_expected.to be(true) }
end
it { is_expected.to be(true) }
end
describe 'indexing' do
context 'when the search_index_all_projects FF is false' do
before do
stub_feature_flags(search_index_all_projects: false)
end
it 'indexes only projects under the group' do
create(:project, name: 'group_test1', group: create(:group, parent: group))
create(:project, name: 'group_test2', description: 'awesome project')
create(:project, name: 'group_test3', group: group)
ensure_elasticsearch_index!
expect(described_class.elastic_search('group_test*', options: { project_ids: :any }).total_count).to eq(2)
expect(described_class.elastic_search('"group_test3"', options: { project_ids: :any }).total_count).to eq(1)
expect(described_class.elastic_search('"group_test2"', options: { project_ids: :any }).total_count).to eq(0)
end
end
context 'when the search_index_all_projects FF is true' do
it 'indexes all projects' do
create(:project, name: 'group_test1', group: create(:group, parent: group))
create(:project, name: 'group_test2', description: 'awesome project')
create(:project, name: 'group_test3', group: group)
ensure_elasticsearch_index!
expect(described_class.elastic_search('group_test*', options: { project_ids: :any }).total_count).to eq(3)
expect(described_class.elastic_search('"group_test3"', options: { project_ids: :any }).total_count).to eq(1)
expect(described_class.elastic_search('"group_test2"', options: { project_ids: :any }).total_count).to eq(1)
end
it 'indexes all projects' do
create(:project, name: 'group_test1', group: create(:group, parent: group))
create(:project, name: 'group_test2', description: 'awesome project')
create(:project, name: 'group_test3', group: group)
ensure_elasticsearch_index!
expect(described_class.elastic_search('group_test*', options: { project_ids: :any }).total_count).to eq(3)
expect(described_class.elastic_search('"group_test3"', options: { project_ids: :any }).total_count).to eq(1)
expect(described_class.elastic_search('"group_test2"', options: { project_ids: :any }).total_count).to eq(1)
end
end
......@@ -177,7 +112,8 @@
raise ArgumentError, 'Invalid operator'
end
expect(described_class.elastic_search('test foo', options: { project_ids: :any }).total_count).to eq(expected_count)
expect(described_class.elastic_search('test foo',
options: { project_ids: :any }).total_count).to eq(expected_count)
end
end
......@@ -233,7 +169,8 @@
expect(described_class.elastic_search('"awesome"', options: { project_ids: project_ids }).total_count).to eq(1)
expect(described_class.elastic_search('test*', options: { project_ids: project_ids }).total_count).to eq(2)
expect(described_class.elastic_search('test*', options: { project_ids: :any }).total_count).to eq(3)
expect(described_class.elastic_search('"someone_elses_project"', options: { project_ids: project_ids }).total_count).to eq(0)
expect(described_class.elastic_search('"someone_elses_project"',
options: { project_ids: project_ids }).total_count).to eq(0)
end
it 'finds partial matches in project names', :sidekiq_inline do
......
......@@ -18,86 +18,37 @@
expect(Elastic::ProcessBookkeepingService).to receive(:track!).with(project)
end
context 'when search_index_all_projects is true' do
before do
stub_feature_flags(search_index_all_projects: true)
end
let(:delete_action) do
expect(ElasticDeleteProjectWorker).to receive(:perform_async)
.with(project.id, project.es_id, delete_project: false)
end
it_behaves_like 'an elasticsearch indexed container' do
context 'when elasticsearch_indexing is false' do
before do
stub_ee_application_setting(elasticsearch_indexing: false)
end
describe 'callbacks' do
describe 'on save' do
subject(:elasticsearch_indexed_project) { build(container, container_attributes) }
it 'triggers index but does not index the data' do
is_expected.to receive(:index)
expect(Elastic::ProcessBookkeepingService).not_to receive(:track!)
elasticsearch_indexed_project.save!
end
end
describe 'on destroy' do
subject(:elasticsearch_indexed_project) { create(container, container_attributes) }
it 'triggers delete_from_index but does not delete data from index' do
is_expected.to receive(:delete_from_index)
expect(ElasticDeleteProjectWorker).not_to receive(:perform_async)
elasticsearch_indexed_project.destroy!
end
end
end
end
end
let(:delete_action) do
expect(ElasticDeleteProjectWorker).to receive(:perform_async)
.with(project.id, project.es_id, delete_project: false)
end
context 'when search_index_all_projects is false' do
before do
stub_feature_flags(search_index_all_projects: false)
end
let(:delete_action) do
expect(ElasticDeleteProjectWorker).to receive(:perform_async)
.with(project.id, project.es_id, delete_project: true)
end
it_behaves_like 'an elasticsearch indexed container' do
context 'when elasticsearch_indexing is false' do
before do
stub_ee_application_setting(elasticsearch_indexing: false)
end
it_behaves_like 'an elasticsearch indexed container' do
context 'when elasticsearch_indexing is false' do
before do
stub_ee_application_setting(elasticsearch_indexing: false)
end
describe 'callbacks' do
describe 'on save' do
subject(:elasticsearch_indexed_project) { build(container, container_attributes) }
describe 'callbacks' do
describe 'on save' do
subject(:elasticsearch_indexed_project) { build(container, container_attributes) }
it 'triggers index but does not index the data' do
is_expected.to receive(:index)
expect(Elastic::ProcessBookkeepingService).not_to receive(:track!)
it 'triggers index but does not index the data' do
is_expected.to receive(:index)
expect(Elastic::ProcessBookkeepingService).not_to receive(:track!)
elasticsearch_indexed_project.save!
end
elasticsearch_indexed_project.save!
end
end
describe 'on destroy' do
subject(:elasticsearch_indexed_project) { create(container, container_attributes) }
describe 'on destroy' do
subject(:elasticsearch_indexed_project) { create(container, container_attributes) }
it 'triggers delete_from_index but does not delete data from index' do
is_expected.to receive(:delete_from_index)
expect(ElasticDeleteProjectWorker).not_to receive(:perform_async)
it 'triggers delete_from_index but does not delete data from index' do
is_expected.to receive(:delete_from_index)
expect(ElasticDeleteProjectWorker).not_to receive(:perform_async)
elasticsearch_indexed_project.destroy!
end
elasticsearch_indexed_project.destroy!
end
end
end
......
......@@ -316,18 +316,6 @@
stub_ee_application_setting(elasticsearch_limit_indexing: true)
end
context 'when the search_index_all_projects feature flag is disabled' do
before do
stub_feature_flags(search_index_all_projects: false)
end
it 'does not queue jobs for projects that should not be indexed' do
expect(Elastic::ProcessInitialBookkeepingService).to receive(:backfill_projects!).with(project1, project3)
task
end
end
context 'when elasticsearch_indexing is disabled' do
before do
stub_ee_application_setting(elasticsearch_indexing: false)
......
......@@ -71,52 +71,28 @@
create(:elasticsearch_indexed_namespace, namespace: indexed_namespace)
end
context 'when search_index_all_projects is true' do
before do
stub_feature_flags(search_index_all_projects: true)
end
it 'invalidates the cache and removes only the associated data from the index' do
expect(Elastic::ProcessInitialBookkeepingService).to receive(:track!).with(project)
expect(Elastic::ProcessInitialBookkeepingService).not_to receive(:backfill_projects!)
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(project.id, project.es_id,
namespace_routing_id: project.root_ancestor.id)
expect(::Gitlab::CurrentSettings)
.to receive(:invalidate_elasticsearch_indexes_cache_for_project!)
.with(project.id).and_call_original
worker.perform(project.id, non_indexed_namespace.id, indexed_namespace.id)
end
it 'invalidates the cache and removes only the associated data from the index' do
expect(Elastic::ProcessInitialBookkeepingService).to receive(:track!).with(project)
expect(Elastic::ProcessInitialBookkeepingService).not_to receive(:backfill_projects!)
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(project.id, project.es_id,
namespace_routing_id: project.root_ancestor.id)
expect(::Gitlab::CurrentSettings)
.to receive(:invalidate_elasticsearch_indexes_cache_for_project!)
.with(project.id).and_call_original
context 'when the reindex_projects_to_apply_routing migration is not finished' do
before do
set_elasticsearch_migration_to(:reindex_projects_to_apply_routing, including: false)
end
it 'tracks with a document reference and deletes without namespace_routing_id' do
expect(Elastic::ProcessInitialBookkeepingService).to receive(:track!)
.with(an_instance_of(Gitlab::Elastic::DocumentReference))
expect(Elastic::ProcessInitialBookkeepingService).not_to receive(:backfill_projects!)
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(project.id, project.es_id)
expect(::Gitlab::CurrentSettings)
.to receive(:invalidate_elasticsearch_indexes_cache_for_project!)
.with(project.id).and_call_original
worker.perform(project.id, non_indexed_namespace.id, indexed_namespace.id)
end
end
worker.perform(project.id, non_indexed_namespace.id, indexed_namespace.id)
end
context 'when search_index_all_projects is false' do
context 'when the reindex_projects_to_apply_routing migration is not finished' do
before do
stub_feature_flags(search_index_all_projects: false)
set_elasticsearch_migration_to(:reindex_projects_to_apply_routing, including: false)
end
it 'invalidates the cache and removes the project and associated data from the index' do
expect(Elastic::ProcessInitialBookkeepingService).not_to receive(:track!)
it 'tracks with a document reference and deletes without namespace_routing_id' do
expect(Elastic::ProcessInitialBookkeepingService).to receive(:track!)
.with(an_instance_of(Gitlab::Elastic::DocumentReference))
expect(Elastic::ProcessInitialBookkeepingService).not_to receive(:backfill_projects!)
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(project.id, project.es_id,
namespace_routing_id: project.root_ancestor.id)
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(project.id, project.es_id)
expect(::Gitlab::CurrentSettings)
.to receive(:invalidate_elasticsearch_indexes_cache_for_project!)
.with(project.id).and_call_original
......
......@@ -28,66 +28,24 @@
Gitlab::Elastic::Helper.build_es_id(es_type: Project.es_type, target_id: non_existing_record_id)
end
context 'when search_index_all_projects is true' do
before do
stub_feature_flags(search_index_all_projects: true)
end
it 'calls ElasticDeleteProjectWorker on the project to delete all documents and returns true' do
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(id, es_id, delete_project: true)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(id)).to be true
end
end
context 'when search_index_all_projects is false' do
before do
stub_feature_flags(search_index_all_projects: false)
end
it 'calls ElasticDeleteProjectWorker on the project to delete all documents and returns true' do
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(id, es_id, delete_project: true)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(id)).to be true
end
it 'calls ElasticDeleteProjectWorker on the project to delete all documents and returns true' do
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(id, es_id, delete_project: true)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(id)).to be true
end
end
context 'when elasticsearch is disabled for Project' do
context 'when search_index_all_projects is true' do
before do
stub_feature_flags(search_index_all_projects: true)
end
it 'calls ElasticDeleteProjectWorker to keep itself and only delete associated documents and returns true' do
allow_next_found_instance_of(Project) do |project|
expect(project).to receive(:use_elasticsearch?).and_return(false)
end
expect(ElasticDeleteProjectWorker).to receive(:perform_async)
.with(project.id, project.es_id, delete_project: false)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(project.id)).to be true
end
end
context 'when search_index_all_projects is false' do
before do
stub_feature_flags(search_index_all_projects: false)
end
it 'calls ElasticDeleteProjectWorker on the project to delete all documents and returns true' do
allow_next_found_instance_of(Project) do |project|
expect(project).to receive(:use_elasticsearch?).and_return(false)
end
expect(ElasticDeleteProjectWorker).to receive(:perform_async)
.with(project.id, project.es_id, delete_project: true)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(project.id)).to be true
it 'calls ElasticDeleteProjectWorker to keep itself and only delete associated documents and returns true' do
allow_next_found_instance_of(Project) do |project|
expect(project).to receive(:use_elasticsearch?).and_return(false)
end
expect(ElasticDeleteProjectWorker).to receive(:perform_async)
.with(project.id, project.es_id, delete_project: false)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(project.id)).to be true
end
end
......
......@@ -56,19 +56,6 @@
worker.perform(namespace.id, :delete)
end
context 'when the search_index_all_projects feature flag is disabled' do
before do
stub_feature_flags(search_index_all_projects: false)
end
it 'deletes all projects belonging to the namespace' do
args = projects.map { |project| [project.id, project.es_id, { delete_project: true }] }
expect(ElasticDeleteProjectWorker).to receive(:bulk_perform_async).with(args)
worker.perform(namespace.id, :delete)
end
end
it 'does not enqueue Search::ElasticGroupAssociationDeletionWorker' do
expect(Search::ElasticGroupAssociationDeletionWorker).not_to receive(:perform_async)
......
......@@ -35,42 +35,17 @@
context 'when container is Project' do
context 'when elasticsearch is disabled for Project' do
context 'when search_index_all_projects is true' do
before do
stub_feature_flags(search_index_all_projects: true)
it 'does not remove the project but removes all associated documents from the index' do
allow_next_found_instance_of(Project) do |project|
expect(project).to receive(:use_elasticsearch?).and_return(false)
end
it 'does not remove the project but removes all associated documents from the index' do
allow_next_found_instance_of(Project) do |project|
expect(project).to receive(:use_elasticsearch?).and_return(false)
end
expect(ElasticDeleteProjectWorker).to receive(:perform_async)
.with(project.id, project.es_id, delete_project: false)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(logger_double).not_to receive(:info)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(project.id, project.class.name)).to be true
end
end
context 'when search_index_all_projects is false' do
before do
stub_feature_flags(search_index_all_projects: false)
end
it 'removes the project and all associated documents from the index' do
allow_next_found_instance_of(Project) do |project|
expect(project).to receive(:use_elasticsearch?).and_return(false)
end
expect(ElasticDeleteProjectWorker).to receive(:perform_async)
.with(project.id, project.es_id, delete_project: true)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(logger_double).not_to receive(:info)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(project.id, project.class.name)).to be true
end
expect(ElasticDeleteProjectWorker).to receive(:perform_async)
.with(project.id, project.es_id, delete_project: false)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(logger_double).not_to receive(:info)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(project.id, project.class.name)).to be true
end
end
......@@ -153,36 +128,14 @@
Gitlab::Elastic::Helper.build_es_id(es_type: Project.es_type, target_id: non_existing_record_id)
end
context 'when search_index_all_projects is false' do
before do
stub_feature_flags(search_index_all_projects: false)
end
it 'removes the project and all associated documents from the index' do
expect(logger_double).to receive(:warn).with(container_id: id, container_type: Project.name,
message: 'Container record not found')
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(id, es_id, delete_project: true)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(logger_double).not_to receive(:info)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(id, Project.name)).to be true
end
end
context 'when search_index_all_projects is true' do
before do
stub_feature_flags(search_index_all_projects: true)
end
it 'removes the project and all associated documents from the index' do
expect(logger_double).to receive(:warn).with(container_id: id, container_type: Project.name,
message: 'Container record not found')
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(id, es_id, delete_project: true)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(logger_double).not_to receive(:info)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(id, Project.name)).to be true
end
it 'removes the project and all associated documents from the index' do
expect(logger_double).to receive(:warn).with(container_id: id, container_type: Project.name,
message: 'Container record not found')
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(id, es_id, delete_project: true)
expect(Gitlab::Elastic::Indexer).not_to receive(:new)
expect(logger_double).not_to receive(:info)
expect(Gitlab::Metrics::GlobalSearchIndexingSlis).not_to receive(:record_apdex)
expect(worker.perform(id, Project.name)).to be true
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment