Commit 14213733 authored by Sean McGivern's avatar Sean McGivern

Stub Elasticsearch using stub_ee_application_setting

parent dc856eef
......@@ -8,7 +8,7 @@ class Spinach::Features::GlobalSearch < Spinach::FeatureSteps
include StubConfiguration
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
......@@ -16,7 +16,7 @@ class Spinach::Features::GlobalSearch < Spinach::FeatureSteps
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
step 'project has all data available for the search' do
......
......@@ -6,7 +6,7 @@ class Spinach::Features::ProjectSearch < Spinach::FeatureSteps
include StubConfiguration
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
......@@ -14,7 +14,7 @@ class Spinach::Features::ProjectSearch < Spinach::FeatureSteps
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
step 'project has all data available for the search' do
......
......@@ -6,7 +6,7 @@ class Spinach::Features::SnippetsSearch < Spinach::FeatureSteps
include StubConfiguration
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
......@@ -14,7 +14,7 @@ class Spinach::Features::SnippetsSearch < Spinach::FeatureSteps
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
step 'there is a snippet "index" with "php rocks" string' do
......
......@@ -25,7 +25,7 @@ module SharedElastic
end
step 'Elasticsearch is enabled' do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
end
def select_filter(name)
......
......@@ -2,13 +2,13 @@ require 'spec_helper'
describe Issue, elastic: true do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
let(:project) { create :project }
......
......@@ -2,13 +2,13 @@ require 'spec_helper'
describe MergeRequest, elastic: true do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
it "searches merge requests" do
......
......@@ -2,13 +2,13 @@ require 'spec_helper'
describe Milestone, elastic: true do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
it "searches milestones" do
......
......@@ -2,13 +2,13 @@ require 'spec_helper'
describe Note, elastic: true do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
it "searches notes" do
......
......@@ -2,13 +2,13 @@ require 'spec_helper'
describe Project, elastic: true do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
it "finds projects" do
......
......@@ -2,13 +2,13 @@ require 'spec_helper'
describe ProjectWiki, elastic: true do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
it "searches wiki page" do
......
......@@ -2,13 +2,13 @@ require 'spec_helper'
describe Repository, elastic: true do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
def index!(project)
......
......@@ -2,13 +2,13 @@ require 'spec_helper'
describe Snippet, elastic: true do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
context 'searching snippets by code' do
......
# coding: utf-8
require 'spec_helper'
describe PostReceive do
......@@ -46,7 +47,7 @@ describe PostReceive do
end
it 'triggers wiki index update when ElasticSearch is enabled' do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
expect_any_instance_of(ProjectWiki).to receive(:index_blobs)
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
# This module is monkey-patched in config/initializers/elastic_client_setup.rb
describe "Monkey-patches to ::Elasticsearch::Model::Client" do
before do
stub_application_setting(elasticsearch_url: ['http://localhost:9200'])
stub_ee_application_setting(elasticsearch_url: ['http://localhost:9200'])
end
it 'uses the same client instance for all subclasses' do
......
......@@ -5,7 +5,7 @@ feature 'Global elastic search' do
let(:project) { create(:project, :repository, namespace: user.namespace) }
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
project.add_master(user)
......@@ -14,7 +14,7 @@ feature 'Global elastic search' do
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
describe 'I search through the issues and I see pagination' do
......
......@@ -15,7 +15,7 @@ feature 'Group elastic search', :js do
end
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
project.add_master(user)
......@@ -26,7 +26,7 @@ feature 'Group elastic search', :js do
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
describe 'issue search' do
......
......@@ -8,13 +8,13 @@ describe SearchHelper do
describe '#parse_search_result_from_elastic' do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
it "returns parsed result" do
......
......@@ -5,7 +5,7 @@ describe Gitlab::Elastic::Indexer do
before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'true')
stub_application_setting(elasticsearch_url: ['http://localhost:9200'])
stub_ee_application_setting(elasticsearch_url: ['http://localhost:9200'])
end
let(:project) { create(:project, :repository) }
......@@ -88,7 +88,7 @@ describe Gitlab::Elastic::Indexer do
context 'experimental indexer enabled' do
before do
stub_application_setting(elasticsearch_experimental_indexer: true)
stub_ee_application_setting(elasticsearch_experimental_indexer: true)
end
it 'uses the normal indexer when not present' do
......
......@@ -6,13 +6,13 @@ describe Gitlab::Elastic::ProjectSearchResults do
let(:query) { 'hello world' }
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
describe 'initialize with empty ref' do
......
# coding: utf-8
require 'spec_helper'
describe Gitlab::Elastic::SearchResults do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
let(:user) { create(:user) }
......
......@@ -1824,7 +1824,7 @@ describe Project do
context 'elasticsearch indexing disabled' do
before do
stub_application_setting(elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_indexing: false)
end
it 'does not index the repository' do
......@@ -1840,7 +1840,7 @@ describe Project do
let(:project) { create(:project, :import_started, import_type: :github) }
before do
stub_application_setting(elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_indexing: true)
end
context 'no index status' do
......
......@@ -1755,13 +1755,13 @@ describe Repository do
describe "Elastic search", :elastic do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
after do
Gitlab::Elastic::Helper.delete_index
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
describe "class method find_commits_by_message_with_elastic" do
......
......@@ -205,11 +205,11 @@ describe GitPushService do
describe "ES indexing" do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
end
after do
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end
it "does not trigger indexer when push to non-default branch" do
......
......@@ -40,7 +40,7 @@ describe Search::GroupService do
describe 'elasticsearch' do
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
# Ensure these are present when the index is refreshed
......
......@@ -7,7 +7,7 @@ describe ElasticCommitIndexerWorker do
describe '#perform' do
before do
stub_application_setting(elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_indexing: true)
end
it 'runs indexer' do
......@@ -17,7 +17,7 @@ describe ElasticCommitIndexerWorker do
end
it 'returns true if ES disabled' do
stub_application_setting(elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_indexing: false)
expect_any_instance_of(Gitlab::Elastic::Indexer).not_to receive(:run)
......
......@@ -4,7 +4,7 @@ describe ElasticIndexerWorker, elastic: true do
subject { described_class.new }
before do
stub_application_setting(elasticsearch_indexing: true)
stub_ee_application_setting(elasticsearch_indexing: true)
Elasticsearch::Model.client =
Gitlab::Elastic::Client.build(Gitlab::CurrentSettings.elasticsearch_config)
......@@ -17,7 +17,7 @@ describe ElasticIndexerWorker, elastic: true do
end
it 'returns true if ES disabled' do
stub_application_setting(elasticsearch_indexing: false)
stub_ee_application_setting(elasticsearch_indexing: false)
expect_any_instance_of(Elasticsearch::Model).not_to receive(:__elasticsearch__)
......
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