diff options
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) |