Commit ec449452 authored by Nick Thomas's avatar Nick Thomas

Merge branch '207491-elasticsearch-wiki-is-not-correctly-indexed-on-import' into 'master'

Resolve "elasticsearch: wiki is not correctly indexed on import"

See merge request gitlab-org/gitlab!29952
parents f786e6d1 e2ed31b1
......@@ -596,6 +596,10 @@ module EE
repository.log_geo_updated_event
wiki.repository.log_geo_updated_event
design_repository.log_geo_updated_event
# Index the wiki repository after import of non-forked projects only, the project repository is indexed
# in ProjectImportState so ElasticSearch will get project repository changes when mirrors are updated
ElasticCommitIndexerWorker.perform_async(id, nil, nil, true) if use_elasticsearch? && !forked?
end
override :import?
......
---
title: Fix wiki indexing for imported projects.
merge_request: 29952
author:
type: fixed
......@@ -1730,6 +1730,41 @@ describe Project do
project.after_import
end
context 'elasticsearch indexing disabled for this project' do
before do
expect(project).to receive(:use_elasticsearch?).and_return(false)
end
it 'does not index the wiki repository' do
expect(ElasticCommitIndexerWorker).not_to receive(:perform_async)
project.after_import
end
end
context 'elasticsearch indexing enabled for this project' do
before do
expect(project).to receive(:use_elasticsearch?).and_return(true)
end
it 'schedules a full index of the wiki repository' do
expect(ElasticCommitIndexerWorker).to receive(:perform_async).with(project.id, nil, nil, true)
project.after_import
end
context 'when project is forked' do
before do
expect(project).to receive(:forked?).and_return(true)
end
it 'does not index the wiki repository' do
expect(ElasticCommitIndexerWorker).not_to receive(:perform_async)
project.after_import
end
end
end
end
describe '#lfs_http_url_to_repo' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment