diff options
author | Robert Speicher <robert@gitlab.com> | 2017-07-12 16:57:57 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-07-12 16:57:57 +0000 |
commit | 9bfe49c2b14e102676b2d528b230d6e4a88425a1 (patch) | |
tree | 262ea85a705886f0e5e2ce8ac7b444d6f21aeb58 /spec | |
parent | 777ec2106415f464c3fe98643a41e847861fede3 (diff) | |
parent | 08ce213c410aa6c6d48fddc2de79accc094564a9 (diff) | |
download | gitlab-ce-9bfe49c2b14e102676b2d528b230d6e4a88425a1.tar.gz |
Merge branch 'migrate-workhorse-send-blob-to-gitaly' into 'master'
Migrate Workhorse SendBlob to Gitaly
Closes gitaly#356
See merge request !12313
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/workhorse_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb index efff0a152a8..124f66a6e0e 100644 --- a/spec/lib/gitlab/workhorse_spec.rb +++ b/spec/lib/gitlab/workhorse_spec.rb @@ -317,4 +317,42 @@ describe Gitlab::Workhorse, lib: true do end end end + + describe '.send_git_blob' do + include FakeBlobHelpers + + let(:blob) { fake_blob } + + subject { described_class.send_git_blob(repository, blob) } + + context 'when Gitaly project_raw_show feature is enabled' do + it 'sets the header correctly' do + key, command, params = decode_workhorse_header(subject) + + expect(key).to eq('Gitlab-Workhorse-Send-Data') + expect(command).to eq('git-blob') + expect(params).to eq({ + 'GitalyServer' => { + address: Gitlab::GitalyClient.address(project.repository_storage), + token: Gitlab::GitalyClient.token(project.repository_storage) + }, + 'GetBlobRequest' => { + repository: repository.gitaly_repository.to_h, + oid: blob.id, + limit: -1 + } + }.deep_stringify_keys) + end + end + + context 'when Gitaly project_raw_show feature is disabled', skip_gitaly_mock: true do + it 'sets the header correctly' do + key, command, params = decode_workhorse_header(subject) + + expect(key).to eq('Gitlab-Workhorse-Send-Data') + expect(command).to eq('git-blob') + expect(params).to eq('RepoPath' => repository.path_to_repo, 'BlobId' => blob.id) + end + end + end end |