diff options
author | Stan Hu <stanhu@gmail.com> | 2019-03-01 21:15:38 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-03-07 04:33:57 -0800 |
commit | 9d3e413aa7d2e3ba0c4743f833291a3282eb79fe (patch) | |
tree | 883218215ef7f84f110065fe5f01a8268047a82b /spec/lib/gitlab/git | |
parent | 28883d8e449acc6cb8ad6f0312d77a8ee5027e75 (diff) | |
download | gitlab-ce-9d3e413aa7d2e3ba0c4743f833291a3282eb79fe.tar.gz |
Bring back Rugged implementation of TreeEntry
This brings back some of the changes in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20099/diffs
For users using Gitaly on top of NFS, accessing the Git data directly
via Rugged is more performant than Gitaly. This merge request introduces
the feature flag `rugged_tree_entry` to activate the Rugged method.
Part of four Rugged changes identified in
https://gitlab.com/gitlab-org/gitlab-ce/issues/57317.
Diffstat (limited to 'spec/lib/gitlab/git')
-rw-r--r-- | spec/lib/gitlab/git/blob_spec.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/lib/gitlab/git/blob_spec.rb b/spec/lib/gitlab/git/blob_spec.rb index a1b5cea88c0..10bc82e24d1 100644 --- a/spec/lib/gitlab/git/blob_spec.rb +++ b/spec/lib/gitlab/git/blob_spec.rb @@ -18,7 +18,7 @@ describe Gitlab::Git::Blob, :seed_helper do end end - describe '.find' do + shared_examples '.find' do context 'nil path' do let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, nil) } @@ -128,6 +128,20 @@ describe Gitlab::Git::Blob, :seed_helper do end end + describe '.find with Gitaly enabled' do + it_behaves_like '.find' + end + + describe '.find with Rugged enabled', :enable_rugged do + it 'calls out to the Rugged implementation' do + allow_any_instance_of(Rugged).to receive(:rev_parse).with(SeedRepo::Commit::ID).and_call_original + + described_class.find(repository, SeedRepo::Commit::ID, 'files/images/6049019_460s.jpg') + end + + it_behaves_like '.find' + end + describe '.raw' do let(:raw_blob) { Gitlab::Git::Blob.raw(repository, SeedRepo::RubyBlob::ID) } let(:bad_blob) { Gitlab::Git::Blob.raw(repository, SeedRepo::BigCommit::ID) } |