Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-15 21:06:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-15 21:06:01 +0300
commit7b8ec6e718331dd1f8330f08f49f01ba2c20b84c (patch)
tree560992bd23b96c85e8b006258a8ece3fb25d088e /spec/tasks
parent03087faa6b679cd82a8a7b5f6491edc414ed91eb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tasks')
-rw-r--r--spec/tasks/gitlab/backup_rake_spec.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/backup_rake_spec.rb b/spec/tasks/gitlab/backup_rake_spec.rb
index b307453f078..e58919c8688 100644
--- a/spec/tasks/gitlab/backup_rake_spec.rb
+++ b/spec/tasks/gitlab/backup_rake_spec.rb
@@ -117,6 +117,45 @@ describe 'gitlab:app namespace rake task' do
expect(raw_repo.empty?).to be(true)
end
end
+
+ context 'when the backup is restored' do
+ let!(:included_project) { create(:project, :repository) }
+
+ before do
+ expect { run_rake_task('gitlab:backup:create') }.to output.to_stdout
+
+ backup_tar = Dir.glob(File.join(Gitlab.config.backup.path, '*_gitlab_backup.tar')).last
+ allow(Dir).to receive(:glob).and_return([backup_tar])
+ allow(File).to receive(:exist?).and_return(true)
+ allow(Kernel).to receive(:system).and_return(true)
+ allow(FileUtils).to receive(:cp_r).and_return(true)
+ allow(FileUtils).to receive(:mv).and_return(true)
+ allow(YAML).to receive(:load_file)
+ .and_return({ gitlab_version: Gitlab::VERSION })
+
+ expect(Rake::Task['gitlab:db:drop_tables']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:db:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:repo:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:builds:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:uploads:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:artifacts:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:pages:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:lfs:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:backup:registry:restore']).to receive(:invoke)
+ expect(Rake::Task['gitlab:shell:setup']).to receive(:invoke)
+
+ # We only need a backup of the repositories for this test
+ stub_env('SKIP', 'db,uploads,builds,artifacts,lfs,registry')
+ end
+
+ it 'restores the data' do
+ expect { run_rake_task('gitlab:backup:restore') }.to output.to_stdout
+
+ raw_repo = included_project.repository.raw
+
+ expect(raw_repo.empty?).to be(false)
+ end
+ end
end # backup_restore task
describe 'backup' do