diff options
author | Toon Claes <toon@gitlab.com> | 2018-11-22 15:44:37 +0100 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2018-11-27 22:48:55 +0100 |
commit | 4711100164a3afc02c9a849ca1e88de4ab4ad956 (patch) | |
tree | 9d60f44ab6e5a5a325f25c85d658e18a2c327293 /spec/migrations | |
parent | 4908e4b3a213fbdea0a45b3cc30774981529b483 (diff) | |
download | gitlab-ce-4711100164a3afc02c9a849ca1e88de4ab4ad956.tar.gz |
Always run CleanUp before writing the git config
Diffstat (limited to 'spec/migrations')
-rw-r--r-- | spec/migrations/backfill_store_project_full_path_in_repo_spec.rb | 26 |
1 files changed, 12 insertions, 14 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 aa5b82e0e43..34f4a36d63d 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,21 +20,19 @@ 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) + expect_next_instance_of(Gitlab::GitalyClient::RepositoryService) do |repository_service| + allow(repository_service).to receive(:cleanup) + expect(repository_service).to receive(:set_config).with('gitlab.fullpath' => expected_path) + end migration.up end it 'retries in case of failure' do - stub_repository_service + repository_service = spy(: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 @@ -42,11 +40,11 @@ describe BackfillStoreProjectFullPathInRepo, :migration do 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) + it 'cleans up repository before writing the config' do + expect_next_instance_of(Gitlab::GitalyClient::RepositoryService) do |repository_service| + expect(repository_service).to receive(:cleanup).ordered + expect(repository_service).to receive(:set_config).ordered + end migration.up end |