Commit 7026b05a authored by James Fargher's avatar James Fargher

Extract second storage path into constant

parent 576a4372
...@@ -2139,18 +2139,17 @@ describe Gitlab::Git::Repository, :seed_helper do ...@@ -2139,18 +2139,17 @@ describe Gitlab::Git::Repository, :seed_helper do
end end
describe '#replicate' do describe '#replicate' do
let(:second_storage_path) { 'tmp/tests/second_storage' }
let(:new_repository) do let(:new_repository) do
Gitlab::Git::Repository.new('test_second_storage', TEST_REPO_PATH, '', 'group/project') Gitlab::Git::Repository.new('test_second_storage', TEST_REPO_PATH, '', 'group/project')
end end
let(:new_repository_path) { File.join(second_storage_path, new_repository.relative_path) } let(:new_repository_path) { File.join(TestEnv::SECOND_STORAGE_PATH, new_repository.relative_path) }
subject { new_repository.replicate(repository) } subject { new_repository.replicate(repository) }
before do before do
stub_storage_settings('test_second_storage' => { stub_storage_settings('test_second_storage' => {
'gitaly_address' => Gitlab.config.repositories.storages.default.gitaly_address, 'gitaly_address' => Gitlab.config.repositories.storages.default.gitaly_address,
'path' => second_storage_path 'path' => TestEnv::SECOND_STORAGE_PATH
}) })
Gitlab::Shell.new.create_repository('test_second_storage', TEST_REPO_PATH, 'group/project') Gitlab::Shell.new.create_repository('test_second_storage', TEST_REPO_PATH, 'group/project')
end end
......
...@@ -2455,7 +2455,7 @@ describe API::Projects do ...@@ -2455,7 +2455,7 @@ describe API::Projects do
end end
it 'returns 200 when repository storage has changed' do it 'returns 200 when repository storage has changed' do
stub_storage_settings('test_second_storage' => { 'path' => 'tmp/tests/second_storage' }) stub_storage_settings('test_second_storage' => { 'path' => TestEnv::SECOND_STORAGE_PATH })
expect do expect do
Sidekiq::Testing.fake! do Sidekiq::Testing.fake! do
......
...@@ -311,7 +311,7 @@ describe Projects::ForkService do ...@@ -311,7 +311,7 @@ describe Projects::ForkService do
fork_before_move = fork_project(project) fork_before_move = fork_project(project)
# Stub everything required to move a project to a Gitaly shard that does not exist # Stub everything required to move a project to a Gitaly shard that does not exist
stub_storage_settings('test_second_storage' => { 'path' => 'tmp/tests/second_storage' }) stub_storage_settings('test_second_storage' => { 'path' => TestEnv::SECOND_STORAGE_PATH })
allow_any_instance_of(Gitlab::Git::Repository).to receive(:replicate) allow_any_instance_of(Gitlab::Git::Repository).to receive(:replicate)
allow_any_instance_of(Gitlab::Git::Repository).to receive(:checksum) allow_any_instance_of(Gitlab::Git::Repository).to receive(:checksum)
.and_return(::Gitlab::Git::BLANK_SHA) .and_return(::Gitlab::Git::BLANK_SHA)
......
...@@ -84,6 +84,7 @@ module TestEnv ...@@ -84,6 +84,7 @@ module TestEnv
TMP_TEST_PATH = Rails.root.join('tmp', 'tests', '**') TMP_TEST_PATH = Rails.root.join('tmp', 'tests', '**')
REPOS_STORAGE = 'default'.freeze REPOS_STORAGE = 'default'.freeze
SECOND_STORAGE_PATH = Rails.root.join('tmp', 'tests', 'second_storage')
# Test environment # Test environment
# #
...@@ -141,7 +142,7 @@ module TestEnv ...@@ -141,7 +142,7 @@ module TestEnv
end end
FileUtils.mkdir_p(repos_path) FileUtils.mkdir_p(repos_path)
FileUtils.mkdir_p(Rails.root.join('tmp', 'tests', 'second_storage')) FileUtils.mkdir_p(SECOND_STORAGE_PATH)
FileUtils.mkdir_p(backup_path) FileUtils.mkdir_p(backup_path)
FileUtils.mkdir_p(pages_path) FileUtils.mkdir_p(pages_path)
FileUtils.mkdir_p(artifacts_path) FileUtils.mkdir_p(artifacts_path)
......
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