diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-03-29 10:31:57 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-03-29 10:31:57 +0000 |
commit | a7cf61355a45a67ef404eeec3e38738f997ef2ec (patch) | |
tree | f64b6940e63c2f88a431f24a0cf890614578444e /spec/lib | |
parent | fea9400ec8a2a31d582a425226494f5fb9f90495 (diff) | |
parent | 7a2325e43c1fe726b4affc544449a763fb52b9e7 (diff) | |
download | gitlab-ce-a7cf61355a45a67ef404eeec3e38738f997ef2ec.tar.gz |
Merge branch 'sh-fix-gitaly-find-commit-caching' into 'master'
Allow ref name caching CommitService#find_commit
Closes #57083
See merge request gitlab-org/gitlab-ce!26248
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/gitaly_client/commit_service_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb index d7bd757149d..6d6107ca3e7 100644 --- a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb @@ -221,6 +221,21 @@ describe Gitlab::GitalyClient::CommitService do expect(commit).to eq(commit_dbl) end end + + context 'when caching of the ref name is enabled' do + it 'returns a cached commit' do + expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:find_commit).once.and_return(double(commit: commit_dbl)) + + commit = nil + 2.times do + ::Gitlab::GitalyClient.allow_ref_name_caching do + commit = described_class.new(repository).find_commit('master') + end + end + + expect(commit).to eq(commit_dbl) + end + end end end |