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:
Diffstat (limited to 'spec/lib/gitlab/gitaly_client/commit_service_spec.rb')
-rw-r--r--spec/lib/gitlab/gitaly_client/commit_service_spec.rb115
1 files changed, 39 insertions, 76 deletions
diff --git a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
index 92860c9232f..3a34d39c722 100644
--- a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
+++ b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
@@ -340,17 +340,12 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
let(:revisions) { [revision] }
let(:gitaly_commits) { create_list(:gitaly_commit, 3) }
let(:expected_commits) { gitaly_commits.map { |c| Gitlab::Git::Commit.new(repository, c) }}
- let(:filter_quarantined_commits) { false }
subject do
- client.list_new_commits(revisions, allow_quarantine: allow_quarantine)
+ client.list_new_commits(revisions)
end
shared_examples 'a #list_all_commits message' do
- before do
- stub_feature_flags(filter_quarantined_commits: filter_quarantined_commits)
- end
-
it 'sends a list_all_commits message' do
expected_repository = repository.gitaly_repository.dup
expected_repository.git_alternate_object_directories = Google::Protobuf::RepeatedField.new(:string)
@@ -360,29 +355,25 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
.with(gitaly_request_with_params(repository: expected_repository), kind_of(Hash))
.and_return([Gitaly::ListAllCommitsResponse.new(commits: gitaly_commits)])
- if filter_quarantined_commits
- # The object directory of the repository must not be set so that we
- # don't use the quarantine directory.
- objects_exist_repo = repository.gitaly_repository.dup
- objects_exist_repo.git_object_directory = ""
-
- # The first request contains the repository, the second request the
- # commit IDs we want to check for existence.
- objects_exist_request = [
- gitaly_request_with_params(repository: objects_exist_repo),
- gitaly_request_with_params(revisions: gitaly_commits.map(&:id))
- ]
-
- objects_exist_response = Gitaly::CheckObjectsExistResponse.new(revisions: revision_existence.map do
- |rev, exists| Gitaly::CheckObjectsExistResponse::RevisionExistence.new(name: rev, exists: exists)
- end)
-
- expect(service).to receive(:check_objects_exist)
- .with(objects_exist_request, kind_of(Hash))
- .and_return([objects_exist_response])
- else
- expect(service).not_to receive(:check_objects_exist)
- end
+ # The object directory of the repository must not be set so that we
+ # don't use the quarantine directory.
+ objects_exist_repo = repository.gitaly_repository.dup
+ objects_exist_repo.git_object_directory = ""
+
+ # The first request contains the repository, the second request the
+ # commit IDs we want to check for existence.
+ objects_exist_request = [
+ gitaly_request_with_params(repository: objects_exist_repo),
+ gitaly_request_with_params(revisions: gitaly_commits.map(&:id))
+ ]
+
+ objects_exist_response = Gitaly::CheckObjectsExistResponse.new(revisions: revision_existence.map do
+ |rev, exists| Gitaly::CheckObjectsExistResponse::RevisionExistence.new(name: rev, exists: exists)
+ end)
+
+ expect(service).to receive(:check_objects_exist)
+ .with(objects_exist_request, kind_of(Hash))
+ .and_return([objects_exist_response])
end
expect(subject).to eq(expected_commits)
@@ -418,49 +409,31 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
}
end
- context 'with allowed quarantine' do
- let(:allow_quarantine) { true }
-
- context 'without commit filtering' do
- it_behaves_like 'a #list_all_commits message'
- end
-
- context 'with commit filtering' do
- let(:filter_quarantined_commits) { true }
-
- context 'reject commits which exist in target repository' do
- let(:revision_existence) { gitaly_commits.to_h { |c| [c.id, true] } }
- let(:expected_commits) { [] }
-
- it_behaves_like 'a #list_all_commits message'
- end
-
- context 'keep commits which do not exist in target repository' do
- let(:revision_existence) { gitaly_commits.to_h { |c| [c.id, false] } }
+ context 'reject commits which exist in target repository' do
+ let(:revision_existence) { gitaly_commits.to_h { |c| [c.id, true] } }
+ let(:expected_commits) { [] }
- it_behaves_like 'a #list_all_commits message'
- end
+ it_behaves_like 'a #list_all_commits message'
+ end
- context 'mixed existing and nonexisting commits' do
- let(:revision_existence) do
- {
- gitaly_commits[0].id => true,
- gitaly_commits[1].id => false,
- gitaly_commits[2].id => true
- }
- end
+ context 'keep commits which do not exist in target repository' do
+ let(:revision_existence) { gitaly_commits.to_h { |c| [c.id, false] } }
- let(:expected_commits) { [Gitlab::Git::Commit.new(repository, gitaly_commits[1])] }
+ it_behaves_like 'a #list_all_commits message'
+ end
- it_behaves_like 'a #list_all_commits message'
- end
+ context 'mixed existing and nonexisting commits' do
+ let(:revision_existence) do
+ {
+ gitaly_commits[0].id => true,
+ gitaly_commits[1].id => false,
+ gitaly_commits[2].id => true
+ }
end
- end
- context 'with disallowed quarantine' do
- let(:allow_quarantine) { false }
+ let(:expected_commits) { [Gitlab::Git::Commit.new(repository, gitaly_commits[1])] }
- it_behaves_like 'a #list_commits message'
+ it_behaves_like 'a #list_all_commits message'
end
end
@@ -472,17 +445,7 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
}
end
- context 'with allowed quarantine' do
- let(:allow_quarantine) { true }
-
- it_behaves_like 'a #list_commits message'
- end
-
- context 'with disallowed quarantine' do
- let(:allow_quarantine) { false }
-
- it_behaves_like 'a #list_commits message'
- end
+ it_behaves_like 'a #list_commits message'
end
end