diff options
Diffstat (limited to 'spec/tasks')
-rw-r--r-- | spec/tasks/gitlab/backup_rake_spec.rb | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/spec/tasks/gitlab/backup_rake_spec.rb b/spec/tasks/gitlab/backup_rake_spec.rb index 4a3b81a072f..9e914f8202e 100644 --- a/spec/tasks/gitlab/backup_rake_spec.rb +++ b/spec/tasks/gitlab/backup_rake_spec.rb @@ -348,14 +348,16 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do project_a = create(:project, :repository) project_snippet_a = create(:project_snippet, :repository, project: project_a, author: project_a.first_owner) project_b = create(:project, :repository, repository_storage: second_storage_name) - project_snippet_b = create(:project_snippet, :repository, project: project_b, author: project_b.first_owner) - project_snippet_b.snippet_repository.update!(shard: project_b.project_repository.shard) + project_snippet_b = create( + :project_snippet, + :repository, + project: project_b, + author: project_b.first_owner, + repository_storage: second_storage_name + ) create(:wiki_page, container: project_a) create(:design, :with_file, issue: create(:issue, project: project_a)) - move_repository_to_secondary(project_b) - move_repository_to_secondary(project_snippet_b) - expect { run_rake_task('gitlab:backup:create') }.to output.to_stdout_from_any_process tar_contents, exit_status = Gitlab::Popen.popen( @@ -400,14 +402,16 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do project_a = create(:project, :repository) project_snippet_a = create(:project_snippet, :repository, project: project_a, author: project_a.first_owner) project_b = create(:project, :repository, repository_storage: second_storage_name) - project_snippet_b = create(:project_snippet, :repository, project: project_b, author: project_b.first_owner) - project_snippet_b.snippet_repository.update!(shard: project_b.project_repository.shard) + project_snippet_b = create( + :project_snippet, + :repository, + project: project_b, + author: project_b.first_owner, + repository_storage: second_storage_name + ) create(:wiki_page, container: project_a) create(:design, :with_file, issue: create(:issue, project: project_a)) - move_repository_to_secondary(project_b) - move_repository_to_secondary(project_snippet_b) - expect { run_rake_task('gitlab:backup:create') }.to output.to_stdout_from_any_process tar_contents, exit_status = Gitlab::Popen.popen( @@ -435,21 +439,6 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do end end end - - def move_repository_to_secondary(record) - Gitlab::GitalyClient::StorageSettings.allow_disk_access do - default_shard_legacy_path = Gitlab.config.repositories.storages.default.legacy_disk_path - secondary_legacy_path = Gitlab.config.repositories.storages[second_storage_name].legacy_disk_path - dst_dir = File.join(secondary_legacy_path, File.dirname(record.disk_path)) - - FileUtils.mkdir_p(dst_dir) unless Dir.exist?(dst_dir) - - FileUtils.mv( - File.join(default_shard_legacy_path, record.disk_path + '.git'), - File.join(secondary_legacy_path, record.disk_path + '.git') - ) - end - end end context 'concurrency settings' do |