diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-07-19 00:28:26 +0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-07-22 01:33:51 +0300 |
commit | 89589007aee6780c3dea2d44df12e9509a22f975 (patch) | |
tree | cfc249d0bd225372be0b6c4d411e261073a1ab3d /config/initializers/6_validations.rb | |
parent | 72f59ddf4c9d276bd565892c0cf79d5622906090 (diff) |
Skip repository storage path valitaions on test environment
Storage path are not created until `TestEnv.init`, so we must skip
their validation on initialization.
Diffstat (limited to 'config/initializers/6_validations.rb')
-rw-r--r-- | config/initializers/6_validations.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/config/initializers/6_validations.rb b/config/initializers/6_validations.rb index 83acdc8ab54..37746968675 100644 --- a/config/initializers/6_validations.rb +++ b/config/initializers/6_validations.rb @@ -13,13 +13,17 @@ def storage_validation_error(message) raise "#{message}. Please fix this in your gitlab.yml before starting GitLab." end -storage_validation_error('No repository storage path defined') if Gitlab.config.repositories.storages.empty? +def validate_storages + storage_validation_error('No repository storage path defined') if Gitlab.config.repositories.storages.empty? -Gitlab.config.repositories.storages.each do |name, path| - storage_validation_error("\"#{name}\" is not a valid storage name") unless storage_name_valid?(name) + Gitlab.config.repositories.storages.each do |name, path| + storage_validation_error("\"#{name}\" is not a valid storage name") unless storage_name_valid?(name) - parent_name, _parent_path = find_parent_path(name, path) - if parent_name - storage_validation_error("#{name} is a nested path of #{parent_name}. Nested paths are not supported for repository storages") + parent_name, _parent_path = find_parent_path(name, path) + if parent_name + storage_validation_error("#{name} is a nested path of #{parent_name}. Nested paths are not supported for repository storages") + end end end + +validate_storages unless Rails.env.test? |