summaryrefslogtreecommitdiff
path: root/spec/lib/backup
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-07 12:08:05 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-07 12:08:05 +0000
commitedb317e9fe43c62229805fae529c550467ee5dc5 (patch)
tree90c590ea021e657b828685ac4459713913928dc9 /spec/lib/backup
parentbdd03bc52aee1c3f37e25ae9b1fc8a27885b7428 (diff)
downloadgitlab-ce-edb317e9fe43c62229805fae529c550467ee5dc5.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/backup')
-rw-r--r--spec/lib/backup/repositories_spec.rb110
1 files changed, 78 insertions, 32 deletions
diff --git a/spec/lib/backup/repositories_spec.rb b/spec/lib/backup/repositories_spec.rb
index f05585b5b89..8bcf1e46c33 100644
--- a/spec/lib/backup/repositories_spec.rb
+++ b/spec/lib/backup/repositories_spec.rb
@@ -113,23 +113,46 @@ RSpec.describe Backup::Repositories do
describe 'paths' do
let_it_be(:project) { create(:project, :repository) }
- let(:paths) { [project.full_path] }
-
- it 'calls enqueue for all repositories on the specified project', :aggregate_failures do
- excluded_project = create(:project, :repository)
- excluded_project_snippet = create(:project_snippet, :repository, project: excluded_project)
- excluded_personal_snippet = create(:personal_snippet, :repository, author: excluded_project.first_owner)
-
- subject.dump(destination, backup_id)
+ context 'project path' do
+ let(:paths) { [project.full_path] }
+
+ it 'calls enqueue for all repositories on the specified project', :aggregate_failures do
+ excluded_project = create(:project, :repository)
+ excluded_project_snippet = create(:project_snippet, :repository, project: excluded_project)
+ excluded_personal_snippet = create(:personal_snippet, :repository, author: excluded_project.first_owner)
+
+ subject.dump(destination, backup_id)
+
+ expect(strategy).to have_received(:start).with(:create, destination, backup_id: backup_id)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_project, Gitlab::GlRepository::PROJECT)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_project_snippet, Gitlab::GlRepository::SNIPPET)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_personal_snippet, Gitlab::GlRepository::SNIPPET)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::PROJECT)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::WIKI)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::DESIGN)
+ expect(strategy).to have_received(:finish!)
+ end
+ end
- expect(strategy).to have_received(:start).with(:create, destination, backup_id: backup_id)
- expect(strategy).not_to have_received(:enqueue).with(excluded_project, Gitlab::GlRepository::PROJECT)
- expect(strategy).not_to have_received(:enqueue).with(excluded_project_snippet, Gitlab::GlRepository::SNIPPET)
- expect(strategy).not_to have_received(:enqueue).with(excluded_personal_snippet, Gitlab::GlRepository::SNIPPET)
- expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::PROJECT)
- expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::WIKI)
- expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::DESIGN)
- expect(strategy).to have_received(:finish!)
+ context 'group path' do
+ let(:paths) { [project.namespace.full_path] }
+
+ it 'calls enqueue for all repositories on all descendant projects', :aggregate_failures do
+ excluded_project = create(:project, :repository)
+ excluded_project_snippet = create(:project_snippet, :repository, project: excluded_project)
+ excluded_personal_snippet = create(:personal_snippet, :repository, author: excluded_project.first_owner)
+
+ subject.dump(destination, backup_id)
+
+ expect(strategy).to have_received(:start).with(:create, destination, backup_id: backup_id)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_project, Gitlab::GlRepository::PROJECT)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_project_snippet, Gitlab::GlRepository::SNIPPET)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_personal_snippet, Gitlab::GlRepository::SNIPPET)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::PROJECT)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::WIKI)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::DESIGN)
+ expect(strategy).to have_received(:finish!)
+ end
end
end
end
@@ -235,23 +258,46 @@ RSpec.describe Backup::Repositories do
end
context 'paths' do
- let(:paths) { [project.full_path] }
-
- it 'calls enqueue for all repositories on the specified project', :aggregate_failures do
- excluded_project = create(:project, :repository)
- excluded_project_snippet = create(:project_snippet, :repository, project: excluded_project)
- excluded_personal_snippet = create(:personal_snippet, :repository, author: excluded_project.first_owner)
-
- subject.restore(destination)
+ context 'project path' do
+ let(:paths) { [project.full_path] }
+
+ it 'calls enqueue for all repositories on the specified project', :aggregate_failures do
+ excluded_project = create(:project, :repository)
+ excluded_project_snippet = create(:project_snippet, :repository, project: excluded_project)
+ excluded_personal_snippet = create(:personal_snippet, :repository, author: excluded_project.first_owner)
+
+ subject.restore(destination)
+
+ expect(strategy).to have_received(:start).with(:restore, destination)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_project, Gitlab::GlRepository::PROJECT)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_project_snippet, Gitlab::GlRepository::SNIPPET)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_personal_snippet, Gitlab::GlRepository::SNIPPET)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::PROJECT)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::WIKI)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::DESIGN)
+ expect(strategy).to have_received(:finish!)
+ end
+ end
- expect(strategy).to have_received(:start).with(:restore, destination)
- expect(strategy).not_to have_received(:enqueue).with(excluded_project, Gitlab::GlRepository::PROJECT)
- expect(strategy).not_to have_received(:enqueue).with(excluded_project_snippet, Gitlab::GlRepository::SNIPPET)
- expect(strategy).not_to have_received(:enqueue).with(excluded_personal_snippet, Gitlab::GlRepository::SNIPPET)
- expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::PROJECT)
- expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::WIKI)
- expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::DESIGN)
- expect(strategy).to have_received(:finish!)
+ context 'group path' do
+ let(:paths) { [project.namespace.full_path] }
+
+ it 'calls enqueue for all repositories on all descendant projects', :aggregate_failures do
+ excluded_project = create(:project, :repository)
+ excluded_project_snippet = create(:project_snippet, :repository, project: excluded_project)
+ excluded_personal_snippet = create(:personal_snippet, :repository, author: excluded_project.first_owner)
+
+ subject.restore(destination)
+
+ expect(strategy).to have_received(:start).with(:restore, destination)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_project, Gitlab::GlRepository::PROJECT)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_project_snippet, Gitlab::GlRepository::SNIPPET)
+ expect(strategy).not_to have_received(:enqueue).with(excluded_personal_snippet, Gitlab::GlRepository::SNIPPET)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::PROJECT)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::WIKI)
+ expect(strategy).to have_received(:enqueue).with(project, Gitlab::GlRepository::DESIGN)
+ expect(strategy).to have_received(:finish!)
+ end
end
end
end