diff options
Diffstat (limited to 'spec/tasks')
-rw-r--r-- | spec/tasks/gitlab/backup_rake_spec.rb | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/spec/tasks/gitlab/backup_rake_spec.rb b/spec/tasks/gitlab/backup_rake_spec.rb index 0d24782f317..a2e5642a72c 100644 --- a/spec/tasks/gitlab/backup_rake_spec.rb +++ b/spec/tasks/gitlab/backup_rake_spec.rb @@ -195,15 +195,12 @@ describe 'gitlab:app namespace rake task' do end context 'multiple repository storages' do - let(:storage_default) do - Gitlab::GitalyClient::StorageSettings.new(@default_storage_hash.merge('path' => 'tmp/tests/default_storage')) - end let(:test_second_storage) do Gitlab::GitalyClient::StorageSettings.new(@default_storage_hash.merge('path' => 'tmp/tests/custom_storage')) end let(:storages) do { - 'default' => storage_default, + 'default' => Gitlab.config.repositories.storages.default, 'test_second_storage' => test_second_storage } end @@ -215,8 +212,7 @@ describe 'gitlab:app namespace rake task' do before do # We only need a backup of the repositories for this test stub_env('SKIP', 'db,uploads,builds,artifacts,lfs,registry') - FileUtils.mkdir(Settings.absolute('tmp/tests/default_storage')) - FileUtils.mkdir(Settings.absolute('tmp/tests/custom_storage')) + allow(Gitlab.config.repositories).to receive(:storages).and_return(storages) # Avoid asking gitaly about the root ref (which will fail beacuse of the @@ -225,14 +221,23 @@ describe 'gitlab:app namespace rake task' do end after do - FileUtils.rm_rf(Settings.absolute('tmp/tests/default_storage')) FileUtils.rm_rf(Settings.absolute('tmp/tests/custom_storage')) end it 'includes repositories in all repository storages' do - project_a = create(:project, :repository, repository_storage: 'default') + project_a = create(:project, :repository) project_b = create(:project, :repository, repository_storage: 'test_second_storage') + b_storage_dir = File.join(Settings.absolute('tmp/tests/custom_storage'), File.dirname(project_b.disk_path)) + + FileUtils.mkdir_p(b_storage_dir) + + # Even when overriding the storage, we have to move it there, so it exists + FileUtils.mv( + File.join(Settings.absolute(storages['default'].legacy_disk_path), project_b.repository.disk_path + '.git'), + Rails.root.join(storages['test_second_storage'].legacy_disk_path, project_b.repository.disk_path + '.git') + ) + expect { run_rake_task('gitlab:backup:create') }.to output.to_stdout tar_contents, exit_status = Gitlab::Popen.popen( |