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:
authorToon Claes <toon@gitlab.com>2018-11-21 22:46:50 +0300
committerToon Claes <toon@gitlab.com>2018-11-28 00:48:55 +0300
commit4908e4b3a213fbdea0a45b3cc30774981529b483 (patch)
tree7c359dd0e405787b81ee5325d2cfd8ea5767fe36 /spec/migrations
parent220208c051ef8a23c801662beeee6b60d00b4b18 (diff)
Run repository cleanup on failure
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/backfill_store_project_full_path_in_repo_spec.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/migrations/backfill_store_project_full_path_in_repo_spec.rb b/spec/migrations/backfill_store_project_full_path_in_repo_spec.rb
index ced6b09dfc0..aa5b82e0e43 100644
--- a/spec/migrations/backfill_store_project_full_path_in_repo_spec.rb
+++ b/spec/migrations/backfill_store_project_full_path_in_repo_spec.rb
@@ -20,6 +20,12 @@ describe BackfillStoreProjectFullPathInRepo, :migration do
describe '#up' do
shared_examples_for 'writes the full path to git config' do
+ let(:repository_service) { spy(:repository_service) }
+
+ def stub_repository_service
+ allow(Gitlab::GitalyClient::RepositoryService).to receive(:new).and_return(repository_service)
+ end
+
it 'writes the git config' do
expect_any_instance_of(Gitlab::GitalyClient::RepositoryService)
.to receive(:set_config).with('gitlab.fullpath' => expected_path)
@@ -28,15 +34,23 @@ describe BackfillStoreProjectFullPathInRepo, :migration do
end
it 'retries in case of failure' do
- repository_service = spy(:repository_service)
+ stub_repository_service
- allow(Gitlab::GitalyClient::RepositoryService).to receive(:new).and_return(repository_service)
allow(repository_service).to receive(:set_config).and_raise(GRPC::BadStatus, 'Retry me')
expect(repository_service).to receive(:set_config).exactly(3).times
migration.up
end
+ it 'cleans up repository in case of failure' do
+ stub_repository_service
+
+ allow(repository_service).to receive(:set_config).and_raise(GRPC::BadStatus, 'Retry me')
+ expect(repository_service).to receive(:cleanup)
+
+ migration.up
+ end
+
context 'legacy storage' do
it 'finds the repository at the correct location' do
Project.find(project.id).create_repository