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:
authorStan Hu <stanhu@gmail.com>2019-03-07 20:38:40 +0300
committerStan Hu <stanhu@gmail.com>2019-03-07 20:38:40 +0300
commitf469bb8e5c3e7114e35862822087a1479d042a12 (patch)
tree46925003a1aa7c7cea72859ea04520f10d7a9177 /spec/services
parenta1a8202f081f75431dee14e246cd55acaddba2aa (diff)
parentb4f205020797319f06c52f769f385876e6427309 (diff)
Merge branch '56618-hashed-storage-skip-validation' into 'master'
Resolve "Hashed storage migration should not be attempted if project does not validate" Closes #56618 See merge request gitlab-org/gitlab-ce!25753
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb6
-rw-r--r--spec/services/projects/hashed_storage/migrate_repository_service_spec.rb6
-rw-r--r--spec/services/projects/hashed_storage/rollback_attachments_service_spec.rb6
-rw-r--r--spec/services/projects/hashed_storage/rollback_repository_service_spec.rb6
4 files changed, 24 insertions, 0 deletions
diff --git a/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb b/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb
index 639dd930618..efe15139717 100644
--- a/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb
+++ b/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb
@@ -76,6 +76,12 @@ describe Projects::HashedStorage::MigrateAttachmentsService do
expect { service.execute }.to raise_error(Projects::HashedStorage::AttachmentCannotMoveError)
end
end
+
+ it 'works even when project validation fails' do
+ allow(project).to receive(:valid?) { false }
+
+ expect { service.execute }.to change { project.hashed_storage?(:attachments) }.to(true)
+ end
end
context '#old_disk_path' do
diff --git a/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb b/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb
index e77e2198439..42b0d256cbf 100644
--- a/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb
+++ b/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb
@@ -102,6 +102,12 @@ describe Projects::HashedStorage::MigrateRepositoryService do
end
end
+ it 'works even when project validation fails' do
+ allow(project).to receive(:valid?) { false }
+
+ expect { service.execute }.to change { project.hashed_storage?(:repository) }.to(true)
+ end
+
def expect_move_repository(from_name, to_name)
expect(gitlab_shell).to receive(:mv_repository).with(project.repository_storage, from_name, to_name).and_call_original
end
diff --git a/spec/services/projects/hashed_storage/rollback_attachments_service_spec.rb b/spec/services/projects/hashed_storage/rollback_attachments_service_spec.rb
index 6f4154d6011..815c85e0866 100644
--- a/spec/services/projects/hashed_storage/rollback_attachments_service_spec.rb
+++ b/spec/services/projects/hashed_storage/rollback_attachments_service_spec.rb
@@ -78,6 +78,12 @@ describe Projects::HashedStorage::RollbackAttachmentsService do
expect { service.execute }.to raise_error(Projects::HashedStorage::AttachmentCannotMoveError)
end
end
+
+ it 'works even when project validation fails' do
+ allow(project).to receive(:valid?) { false }
+
+ expect { service.execute }.to change { project.hashed_storage?(:attachments) }.to(false)
+ end
end
context '#old_disk_path' do
diff --git a/spec/services/projects/hashed_storage/rollback_repository_service_spec.rb b/spec/services/projects/hashed_storage/rollback_repository_service_spec.rb
index 41927934501..bd4354a7df3 100644
--- a/spec/services/projects/hashed_storage/rollback_repository_service_spec.rb
+++ b/spec/services/projects/hashed_storage/rollback_repository_service_spec.rb
@@ -104,6 +104,12 @@ describe Projects::HashedStorage::RollbackRepositoryService, :clean_gitlab_redis
end
end
+ it 'works even when project validation fails' do
+ allow(project).to receive(:valid?) { false }
+
+ expect { service.execute }.to change { project.legacy_storage? }.to(true)
+ end
+
def expect_move_repository(from_name, to_name)
expect(gitlab_shell).to receive(:mv_repository).with(project.repository_storage, from_name, to_name).and_call_original
end