Commit 08c07ad1 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'rs-stub-storage-availability-check' into 'master'

Stub `ForkedStorageCheck.storage_available?` by default in all specs

See merge request !13726
parents 459631ac a6fbd864
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::Storage::ForkedStorageCheck, skip_database_cleaner: true do describe Gitlab::Git::Storage::ForkedStorageCheck, broken_storage: true, skip_database_cleaner: true do
let(:existing_path) do let(:existing_path) do
existing_path = TestEnv.repos_path existing_path = TestEnv.repos_path
FileUtils.mkdir_p(existing_path) FileUtils.mkdir_p(existing_path)
......
...@@ -105,6 +105,18 @@ RSpec.configure do |config| ...@@ -105,6 +105,18 @@ RSpec.configure do |config|
reset_delivered_emails! reset_delivered_emails!
end end
# Stub the `ForkedStorageCheck.storage_available?` method unless
# `:broken_storage` metadata is defined
#
# This check can be slow and is unnecessary in a test environment where we
# know the storage is available, because we create it at runtime
config.before(:example) do |example|
unless example.metadata[:broken_storage]
allow(Gitlab::Git::Storage::ForkedStorageCheck)
.to receive(:storage_available?).and_return(true)
end
end
config.around(:each, :use_clean_rails_memory_store_caching) do |example| config.around(:each, :use_clean_rails_memory_store_caching) do |example|
caching_store = Rails.cache caching_store = Rails.cache
Rails.cache = ActiveSupport::Cache::MemoryStore.new Rails.cache = ActiveSupport::Cache::MemoryStore.new
......
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