diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/lib/backup | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/lib/backup')
-rw-r--r-- | spec/lib/backup/files_spec.rb | 18 | ||||
-rw-r--r-- | spec/lib/backup/repositories_spec.rb | 4 |
2 files changed, 19 insertions, 3 deletions
diff --git a/spec/lib/backup/files_spec.rb b/spec/lib/backup/files_spec.rb index dbc04704fba..450e396a389 100644 --- a/spec/lib/backup/files_spec.rb +++ b/spec/lib/backup/files_spec.rb @@ -149,13 +149,27 @@ RSpec.describe Backup::Files do end it 'excludes tmp dirs from rsync' do - expect(Gitlab::Popen).to receive(:popen).with(%w(rsync -a --exclude=lost+found --exclude=/@pages.tmp /var/gitlab-pages /var/gitlab-backup)).and_return(['', 0]) + expect(Gitlab::Popen).to receive(:popen) + .with(%w(rsync -a --delete --exclude=lost+found --exclude=/@pages.tmp /var/gitlab-pages /var/gitlab-backup)) + .and_return(['', 0]) subject.dump end + it 'retries if rsync fails due to vanishing files' do + expect(Gitlab::Popen).to receive(:popen) + .with(%w(rsync -a --delete --exclude=lost+found --exclude=/@pages.tmp /var/gitlab-pages /var/gitlab-backup)) + .and_return(['rsync failed', 24], ['', 0]) + + expect do + subject.dump + end.to output(/files vanished during rsync, retrying/).to_stdout + end + it 'raises an error and outputs an error message if rsync failed' do - allow(Gitlab::Popen).to receive(:popen).with(%w(rsync -a --exclude=lost+found --exclude=/@pages.tmp /var/gitlab-pages /var/gitlab-backup)).and_return(['rsync failed', 1]) + allow(Gitlab::Popen).to receive(:popen) + .with(%w(rsync -a --delete --exclude=lost+found --exclude=/@pages.tmp /var/gitlab-pages /var/gitlab-backup)) + .and_return(['rsync failed', 1]) expect do subject.dump diff --git a/spec/lib/backup/repositories_spec.rb b/spec/lib/backup/repositories_spec.rb index 9c139e9f954..492058c6a00 100644 --- a/spec/lib/backup/repositories_spec.rb +++ b/spec/lib/backup/repositories_spec.rb @@ -242,7 +242,9 @@ RSpec.describe Backup::Repositories do # 4 times = project repo + wiki repo + project_snippet repo + personal_snippet repo expect(Repository).to receive(:new).exactly(4).times.and_wrap_original do |method, *original_args| - repository = method.call(*original_args) + full_path, container, kwargs = original_args + + repository = method.call(full_path, container, **kwargs) expect(repository).to receive(:remove) |