Commit 51907eef authored by Sean McGivern's avatar Sean McGivern

Merge branch '4813-fix-ee-projects-destroy_service_spec' into 'master'

Reset column information after the schema is migrated in MigrationsHelpers.schema_migrate_up!

Closes #4813

See merge request gitlab-org/gitlab-ee!4397
parents fb3005fe 14213733
......@@ -105,10 +105,6 @@ class ApplicationSetting < ActiveRecord::Base
presence: true,
numericality: { only_integer: true, greater_than: 0 }
validates :repository_size_limit,
presence: true,
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :max_artifacts_size,
presence: true,
numericality: { only_integer: true, greater_than: 0 }
......@@ -119,14 +115,6 @@ class ApplicationSetting < ActiveRecord::Base
presence: true,
numericality: { only_integer: true, greater_than: 0 }
validates :elasticsearch_url,
presence: { message: "can't be blank when indexing is enabled" },
if: :elasticsearch_indexing?
validates :elasticsearch_aws_region,
presence: { message: "can't be blank when using aws hosted elasticsearch" },
if: ->(setting) { setting.elasticsearch_indexing? && setting.elasticsearch_aws? }
validates :repository_storages, presence: true
validate :check_repository_storages
......@@ -343,11 +331,7 @@ class ApplicationSetting < ActiveRecord::Base
usage_ping_enabled: Settings.gitlab['usage_ping_enabled'],
gitaly_timeout_fast: 10,
gitaly_timeout_medium: 30,
gitaly_timeout_default: 55,
slack_app_enabled: false,
slack_app_id: nil,
slack_app_secret: nil,
slack_app_verification_token: nil
gitaly_timeout_default: 55
}
end
......@@ -363,36 +347,6 @@ class ApplicationSetting < ActiveRecord::Base
end
end
def elasticsearch_indexing
License.feature_available?(:elastic_search) && super
end
alias_method :elasticsearch_indexing?, :elasticsearch_indexing
def elasticsearch_search
License.feature_available?(:elastic_search) && super
end
alias_method :elasticsearch_search?, :elasticsearch_search
def elasticsearch_url
read_attribute(:elasticsearch_url).split(',').map(&:strip)
end
def elasticsearch_url=(values)
cleaned = values.split(',').map {|url| url.strip.gsub(%r{/*\z}, '') }
write_attribute(:elasticsearch_url, cleaned.join(','))
end
def elasticsearch_config
{
url: elasticsearch_url,
aws: elasticsearch_aws,
aws_access_key: elasticsearch_aws_access_key,
aws_secret_access_key: elasticsearch_aws_secret_access_key,
aws_region: elasticsearch_aws_region
}
end
def home_page_url_column_exists?
ActiveRecord::Base.connection.column_exists?(:application_settings, :home_page_url)
end
......
......@@ -27,21 +27,40 @@ module EE
numericality: { allow_nil: true, only_integer: true, greater_than: 0 }
validate :mirror_capacity_threshold_less_than
validates :repository_size_limit,
presence: true,
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :elasticsearch_url,
presence: { message: "can't be blank when indexing is enabled" },
if: ->(setting) { setting.elasticsearch_indexing? }
validates :elasticsearch_aws_region,
presence: { message: "can't be blank when using aws hosted elasticsearch" },
if: ->(setting) { setting.elasticsearch_indexing? && setting.elasticsearch_aws? }
end
module ClassMethods
extend ::Gitlab::Utils::Override
override :defaults
def defaults
super.merge(
allow_group_owners_to_manage_ldap: true,
default_project_creation: ::EE::Gitlab::Access::DEVELOPER_MASTER_PROJECT_ACCESS,
elasticsearch_url: ENV['ELASTIC_URL'] || 'http://localhost:9200',
elasticsearch_aws: false,
elasticsearch_aws_region: ENV['ELASTIC_REGION'] || 'us-east-1',
repository_size_limit: 0,
mirror_max_delay: Settings.gitlab['mirror_max_delay'],
mirror_max_capacity: Settings.gitlab['mirror_max_capacity'],
elasticsearch_url: ENV['ELASTIC_URL'] || 'http://localhost:9200',
mirror_capacity_threshold: Settings.gitlab['mirror_capacity_threshold'],
allow_group_owners_to_manage_ldap: true,
mirror_available: true
mirror_max_capacity: Settings.gitlab['mirror_max_capacity'],
mirror_max_delay: Settings.gitlab['mirror_max_delay'],
mirror_available: true,
repository_size_limit: 0,
slack_app_enabled: false,
slack_app_id: nil,
slack_app_secret: nil,
slack_app_verification_token: nil
)
end
end
......@@ -50,6 +69,40 @@ module EE
check_namespace_plan? && ::Gitlab.dev_env_or_com?
end
def elasticsearch_indexing
return false unless elasticsearch_indexing_column_exists?
License.feature_available?(:elastic_search) && super
end
alias_method :elasticsearch_indexing?, :elasticsearch_indexing
def elasticsearch_search
return false unless elasticsearch_search_column_exists?
License.feature_available?(:elastic_search) && super
end
alias_method :elasticsearch_search?, :elasticsearch_search
def elasticsearch_url
read_attribute(:elasticsearch_url).split(',').map(&:strip)
end
def elasticsearch_url=(values)
cleaned = values.split(',').map {|url| url.strip.gsub(%r{/*\z}, '') }
write_attribute(:elasticsearch_url, cleaned.join(','))
end
def elasticsearch_config
{
url: elasticsearch_url,
aws: elasticsearch_aws,
aws_access_key: elasticsearch_aws_access_key,
aws_secret_access_key: elasticsearch_aws_secret_access_key,
aws_region: elasticsearch_aws_region
}
end
private
def mirror_max_delay_in_minutes
......@@ -63,5 +116,13 @@ module EE
errors.add(:mirror_capacity_threshold, "Project's mirror capacity threshold can't be higher than it's maximum capacity")
end
end
def elasticsearch_indexing_column_exists?
ActiveRecord::Base.connection.column_exists?(:application_settings, :elasticsearch_indexing)
end
def elasticsearch_search_column_exists?
ActiveRecord::Base.connection.column_exists?(:application_settings, :elasticsearch_search)
end
end
end
require Rails.root.join('spec', 'support', 'stub_configuration')
require_dependency Rails.root.join('spec', 'support', 'stub_configuration')
class Spinach::Features::GlobalSearch < Spinach::FeatureSteps
include SharedAuthentication
......@@ -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)
......
module EE
module StubConfiguration
def stub_ee_application_setting(messages)
add_predicates(messages)
# Stubbing both of these because we're not yet consistent with how we access
# current application settings
allow_any_instance_of(EE::ApplicationSetting).to receive_messages(to_settings(messages))
allow(::Gitlab::CurrentSettings.current_application_settings)
.to receive_messages(to_settings(messages))
# Ensure that we don't use the Markdown cache when stubbing these values
allow_any_instance_of(EE::ApplicationSetting).to receive(:cached_html_up_to_date?).and_return(false)
end
end
end
......@@ -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
......
......@@ -11,7 +11,7 @@ describe 'GlobalSearch' do
let(:guest) { create :user }
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_developer(member)
......@@ -21,7 +21,7 @@ describe 'GlobalSearch' 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
context "Respect feature visibility levels" 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
......
......@@ -15,10 +15,6 @@ describe Gitlab::BackgroundMigration::DeserializeMergeRequestDiffsAndCommits, :m
.to receive(:commits_count=).and_return(nil)
end
after do
[Project, MergeRequest, MergeRequestDiff].each(&:reset_column_information)
end
def diffs_to_hashes(diffs)
diffs.as_json(only: Gitlab::Git::Diff::SERIALIZE_KEYS).map(&:with_indifferent_access)
end
......
......@@ -7,10 +7,6 @@ describe Gitlab::BackgroundMigration::PopulateMergeRequestMetricsWithEventsData,
.to receive(:commits_count=).and_return(nil)
end
after do
[Project, MergeRequest, MergeRequestDiff].each(&:reset_column_information)
end
describe '#perform' do
let(:mr_with_event) { create(:merge_request) }
let!(:merged_event) { create(:event, :merged, target: mr_with_event) }
......
......@@ -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) }
......
......@@ -21,7 +21,7 @@ describe ConvertCustomNotificationSettingsToColumns, :migration do
events[event] = true
end
user = build(:user).becomes(user_class).tap(&:save!)
user = user_class.create!(email: "user-#{SecureRandom.hex}@example.org", username: "user-#{SecureRandom.hex}", encrypted_password: '12345678')
create_params = { user_id: user.id, level: params[:level], events: events }
notification_setting = described_class::NotificationSetting.create(create_params)
......@@ -37,7 +37,7 @@ describe ConvertCustomNotificationSettingsToColumns, :migration do
events[event] = true
end
user = build(:user).becomes(user_class).tap(&:save!)
user = user_class.create!(email: "user-#{SecureRandom.hex}@example.org", username: "user-#{SecureRandom.hex}", encrypted_password: '12345678')
create_params = events.merge(user_id: user.id, level: params[:level])
notification_setting = described_class::NotificationSetting.create(create_params)
......
......@@ -19,10 +19,6 @@ describe RemoveEmptyForkNetworks, :migration do
deleted_project.destroy!
end
after do
Upload.reset_column_information
end
it 'deletes only the fork network without members' do
expect(fork_networks.count).to eq(2)
......
......@@ -1825,7 +1825,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
......@@ -1841,7 +1841,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
......
......@@ -1777,13 +1777,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
......
......@@ -15,18 +15,22 @@ module MigrationsHelpers
ActiveRecord::Migrator.migrations(migrations_paths)
end
def reset_column_in_migration_models
def clear_schema_cache!
ActiveRecord::Base.connection_pool.connections.each do |conn|
conn.schema_cache.clear!
end
end
described_class.constants.sort.each do |name|
const = described_class.const_get(name)
def reset_column_in_all_models
clear_schema_cache!
if const.is_a?(Class) && const < ActiveRecord::Base
const.reset_column_information
end
end
# Reset column information for the most offending classes **after** we
# migrated the schema up, otherwise, column information could be outdated
ActiveRecord::Base.descendants.each { |klass| klass.reset_column_information }
# Without that, we get errors because of missing attributes, e.g.
# super: no superclass method `elasticsearch_indexing' for #<ApplicationSetting:0x00007f85628508d8>
ApplicationSetting.define_attribute_methods
end
def previous_migration
......@@ -45,7 +49,7 @@ module MigrationsHelpers
migration_schema_version)
end
reset_column_in_migration_models
reset_column_in_all_models
end
def schema_migrate_up!
......@@ -53,7 +57,7 @@ module MigrationsHelpers
ActiveRecord::Migrator.migrate(migrations_paths)
end
reset_column_in_migration_models
reset_column_in_all_models
end
def disable_migrations_output
......
require_dependency Rails.root.join('spec', 'ee', 'support', 'stub_configuration')
module StubConfiguration
prepend EE::StubConfiguration
def stub_application_setting(messages)
add_predicates(messages)
......
......@@ -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