diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2019-07-01 09:56:09 +0000 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2019-07-01 09:56:09 +0000 |
commit | 0e8b76e1918a7ca441e9eb98819f10da24e0588a (patch) | |
tree | e8e9002a878bfeff66bf8fabfa808d170b3f3e26 | |
parent | 8775e4a1faf13a01451e71ea9ef729dc52e6d3c1 (diff) | |
parent | cb4a514207c914069410a01de8b493076156752a (diff) | |
download | gitlab-ce-0e8b76e1918a7ca441e9eb98819f10da24e0588a.tar.gz |
Merge branch 'zj-circuit-breaker-removal-part-deux' into 'master'
Remove ignored circuit_breaker columns
See merge request gitlab-org/gitlab-ce!30159
-rw-r--r-- | app/models/application_setting.rb | 5 | ||||
-rw-r--r-- | config/initializers/6_validations.rb | 21 | ||||
-rw-r--r-- | spec/initializers/6_validations_spec.rb | 20 |
3 files changed, 6 insertions, 40 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index cd645850af3..fbd8036653a 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -23,11 +23,6 @@ class ApplicationSetting < ApplicationRecord serialize :domain_blacklist, Array # rubocop:disable Cop/ActiveRecordSerialize serialize :repository_storages # rubocop:disable Cop/ActiveRecordSerialize - ignore_column :circuitbreaker_failure_count_threshold - ignore_column :circuitbreaker_failure_reset_time - ignore_column :circuitbreaker_storage_timeout - ignore_column :circuitbreaker_access_retries - ignore_column :circuitbreaker_check_interval ignore_column :koding_url ignore_column :koding_enabled ignore_column :sentry_enabled diff --git a/config/initializers/6_validations.rb b/config/initializers/6_validations.rb index bf9e5a50382..827b15e5c8d 100644 --- a/config/initializers/6_validations.rb +++ b/config/initializers/6_validations.rb @@ -1,24 +1,15 @@ -def storage_name_valid?(name) - !!(name =~ /\A[a-zA-Z0-9\-_]+\z/) -end - def storage_validation_error(message) raise "#{message}. Please fix this in your gitlab.yml before starting GitLab." end def validate_storages_config - storage_validation_error('No repository storage path defined') if Gitlab.config.repositories.storages.empty? - - Gitlab.config.repositories.storages.each do |name, repository_storage| - storage_validation_error("\"#{name}\" is not a valid storage name") unless storage_name_valid?(name) - - %w(failure_count_threshold failure_reset_time storage_timeout).each do |setting| - # Falling back to the defaults is fine! - next if repository_storage[setting].nil? + if Gitlab.config.repositories.storages.empty? + storage_validation_error('No repository storage path defined') + end - unless repository_storage[setting].to_f > 0 - storage_validation_error("`#{setting}` for storage `#{name}` needs to be greater than 0") - end + Gitlab.config.repositories.storages.keys.each do |name| + unless /\A[a-zA-Z0-9\-_]+\z/.match?(name) + storage_validation_error("\"#{name}\" is not a valid storage name") end end end diff --git a/spec/initializers/6_validations_spec.rb b/spec/initializers/6_validations_spec.rb index f96e5a2133f..73fbd4c7a44 100644 --- a/spec/initializers/6_validations_spec.rb +++ b/spec/initializers/6_validations_spec.rb @@ -2,16 +2,6 @@ require 'spec_helper' require_relative '../../config/initializers/6_validations.rb' describe '6_validations' do - before :all do - FileUtils.mkdir_p('tmp/tests/paths/a/b/c/d') - FileUtils.mkdir_p('tmp/tests/paths/a/b/c2') - FileUtils.mkdir_p('tmp/tests/paths/a/b/d') - end - - after :all do - FileUtils.rm_rf('tmp/tests/paths') - end - describe 'validate_storages_config' do context 'with correct settings' do before do @@ -23,16 +13,6 @@ describe '6_validations' do end end - context 'when one of the settings is incorrect' do - before do - mock_storages('foo' => Gitlab::GitalyClient::StorageSettings.new('path' => 'tmp/tests/paths/a/b/c', 'failure_count_threshold' => 'not a number')) - end - - it 'throws an error' do - expect { validate_storages_config }.to raise_error(/failure_count_threshold/) - end - end - context 'with invalid storage names' do before do mock_storages('name with spaces' => Gitlab::GitalyClient::StorageSettings.new('path' => 'tmp/tests/paths/a/b/c')) |