Commit e2606758 authored by Stan Hu's avatar Stan Hu

Fix spec failures in ee/spec/lib/gitlab/elastic/search_results_spec.rb

There are two issues:

1. When a Wiki was disabled, the spec was still trying to create a
Wiki page, which would cause Gitaly to create the repository and fire
hooks. Since Rails isn't running an internal API server, this fails.

2. For private Wikis, the Wiki repository needs to be created with the
:wiki_repo trait in order to clear hooks to prevent Gitaly from
contacting the internal API server.
parent d6d55928
...@@ -537,8 +537,10 @@ describe Gitlab::Elastic::SearchResults do ...@@ -537,8 +537,10 @@ describe Gitlab::Elastic::SearchResults do
subject(:wiki_blobs) { results.objects('wiki_blobs') } subject(:wiki_blobs) { results.objects('wiki_blobs') }
before do before do
if project_1.wiki_enabled?
project_1.wiki.create_page('index_page', 'term') project_1.wiki.create_page('index_page', 'term')
project_1.wiki.index_blobs project_1.wiki.index_blobs
end
Gitlab::Elastic::Helper.refresh_index Gitlab::Elastic::Helper.refresh_index
end end
...@@ -593,7 +595,7 @@ describe Gitlab::Elastic::SearchResults do ...@@ -593,7 +595,7 @@ describe Gitlab::Elastic::SearchResults do
end end
context 'when wiki is internal' do context 'when wiki is internal' do
let(:project_1) { create(:project, :public, :repository, :wiki_private) } let(:project_1) { create(:project, :public, :repository, :wiki_private, :wiki_repo) }
context 'search by member' do context 'search by member' do
let(:limit_project_ids) { [project_1.id] } let(:limit_project_ids) { [project_1.id] }
......
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