Commit a89f18bf authored by Andrew Newdigate's avatar Andrew Newdigate Committed by Sean McGivern

Renamed Gitaly services

parent a8aae1be
...@@ -322,7 +322,7 @@ class Commit ...@@ -322,7 +322,7 @@ class Commit
def raw_diffs(*args) def raw_diffs(*args)
if Gitlab::GitalyClient.feature_enabled?(:commit_raw_diffs) if Gitlab::GitalyClient.feature_enabled?(:commit_raw_diffs)
Gitlab::GitalyClient::Commit.new(project.repository).diff_from_parent(self, *args) Gitlab::GitalyClient::CommitService.new(project.repository).diff_from_parent(self, *args)
else else
raw.diffs(*args) raw.diffs(*args)
end end
...@@ -331,7 +331,7 @@ class Commit ...@@ -331,7 +331,7 @@ class Commit
def raw_deltas def raw_deltas
@deltas ||= Gitlab::GitalyClient.migrate(:commit_deltas) do |is_enabled| @deltas ||= Gitlab::GitalyClient.migrate(:commit_deltas) do |is_enabled|
if is_enabled if is_enabled
Gitlab::GitalyClient::Commit.new(project.repository).commit_deltas(self) Gitlab::GitalyClient::CommitService.new(project.repository).commit_deltas(self)
else else
raw.deltas raw.deltas
end end
......
...@@ -150,7 +150,7 @@ module API ...@@ -150,7 +150,7 @@ module API
# #
# begin # begin
# repository = wiki? ? project.wiki.repository : project.repository # repository = wiki? ? project.wiki.repository : project.repository
# Gitlab::GitalyClient::Notifications.new(repository.raw_repository).post_receive # Gitlab::GitalyClient::NotificationService.new(repository.raw_repository).post_receive
# rescue GRPC::Unavailable => e # rescue GRPC::Unavailable => e
# render_api_error!(e, 500) # render_api_error!(e, 500)
# end # end
......
...@@ -29,7 +29,7 @@ module Gitlab ...@@ -29,7 +29,7 @@ module Gitlab
path = path.sub(/\A\/*/, '') path = path.sub(/\A\/*/, '')
path = '/' if path.empty? path = '/' if path.empty?
name = File.basename(path) name = File.basename(path)
entry = Gitlab::GitalyClient::Commit.new(repository).tree_entry(sha, path, MAX_DATA_DISPLAY_SIZE) entry = Gitlab::GitalyClient::CommitService.new(repository).tree_entry(sha, path, MAX_DATA_DISPLAY_SIZE)
return unless entry return unless entry
case entry.type case entry.type
...@@ -87,10 +87,10 @@ module Gitlab ...@@ -87,10 +87,10 @@ module Gitlab
def raw(repository, sha) def raw(repository, sha)
Gitlab::GitalyClient.migrate(:git_blob_raw) do |is_enabled| Gitlab::GitalyClient.migrate(:git_blob_raw) do |is_enabled|
if is_enabled if is_enabled
Gitlab::GitalyClient::Blob.new(repository).get_blob(oid: sha, limit: MAX_DATA_DISPLAY_SIZE) Gitlab::GitalyClient::BlobService.new(repository).get_blob(oid: sha, limit: MAX_DATA_DISPLAY_SIZE)
else else
blob = repository.lookup(sha) blob = repository.lookup(sha)
new( new(
id: blob.oid, id: blob.oid,
size: blob.size, size: blob.size,
...@@ -182,7 +182,7 @@ module Gitlab ...@@ -182,7 +182,7 @@ module Gitlab
Gitlab::GitalyClient.migrate(:git_blob_load_all_data) do |is_enabled| Gitlab::GitalyClient.migrate(:git_blob_load_all_data) do |is_enabled|
@data = begin @data = begin
if is_enabled if is_enabled
Gitlab::GitalyClient::Blob.new(repository).get_blob(oid: id, limit: -1).data Gitlab::GitalyClient::BlobService.new(repository).get_blob(oid: id, limit: -1).data
else else
repository.lookup(id).content repository.lookup(id).content
end end
......
...@@ -1106,11 +1106,11 @@ module Gitlab ...@@ -1106,11 +1106,11 @@ module Gitlab
end end
def gitaly_ref_client def gitaly_ref_client
@gitaly_ref_client ||= Gitlab::GitalyClient::Ref.new(self) @gitaly_ref_client ||= Gitlab::GitalyClient::RefService.new(self)
end end
def gitaly_commit_client def gitaly_commit_client
@gitaly_commit_client ||= Gitlab::GitalyClient::Commit.new(self) @gitaly_commit_client ||= Gitlab::GitalyClient::CommitService.new(self)
end end
def gitaly_migrate(method, &block) def gitaly_migrate(method, &block)
......
module Gitlab module Gitlab
module GitalyClient module GitalyClient
class Blob class BlobService
def initialize(repository) def initialize(repository)
@gitaly_repo = repository.gitaly_repository @gitaly_repo = repository.gitaly_repository
end end
def get_blob(oid:, limit:) def get_blob(oid:, limit:)
request = Gitaly::GetBlobRequest.new( request = Gitaly::GetBlobRequest.new(
repository: @gitaly_repo, repository: @gitaly_repo,
......
module Gitlab module Gitlab
module GitalyClient module GitalyClient
class Commit class CommitService
# The ID of empty tree. # The ID of empty tree.
# See http://stackoverflow.com/a/40884093/1856239 and https://github.com/git/git/blob/3ad8b5bf26362ac67c9020bf8c30eee54a84f56d/cache.h#L1011-L1012 # See http://stackoverflow.com/a/40884093/1856239 and https://github.com/git/git/blob/3ad8b5bf26362ac67c9020bf8c30eee54a84f56d/cache.h#L1011-L1012
EMPTY_TREE_ID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'.freeze EMPTY_TREE_ID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'.freeze
...@@ -17,20 +17,20 @@ module Gitlab ...@@ -17,20 +17,20 @@ module Gitlab
child_id: child_id child_id: child_id
) )
GitalyClient.call(@repository.storage, :commit, :commit_is_ancestor, request).value GitalyClient.call(@repository.storage, :commit_service, :commit_is_ancestor, request).value
end end
def diff_from_parent(commit, options = {}) def diff_from_parent(commit, options = {})
request_params = commit_diff_request_params(commit, options) request_params = commit_diff_request_params(commit, options)
request_params[:ignore_whitespace_change] = options.fetch(:ignore_whitespace_change, false) request_params[:ignore_whitespace_change] = options.fetch(:ignore_whitespace_change, false)
request = Gitaly::CommitDiffRequest.new(request_params) request = Gitaly::CommitDiffRequest.new(request_params)
response = GitalyClient.call(@repository.storage, :diff, :commit_diff, request) response = GitalyClient.call(@repository.storage, :diff_service, :commit_diff, request)
Gitlab::Git::DiffCollection.new(GitalyClient::DiffStitcher.new(response), options) Gitlab::Git::DiffCollection.new(GitalyClient::DiffStitcher.new(response), options)
end end
def commit_deltas(commit) def commit_deltas(commit)
request = Gitaly::CommitDeltaRequest.new(commit_diff_request_params(commit)) request = Gitaly::CommitDeltaRequest.new(commit_diff_request_params(commit))
response = GitalyClient.call(@repository.storage, :diff, :commit_delta, request) response = GitalyClient.call(@repository.storage, :diff_service, :commit_delta, request)
response.flat_map do |msg| response.flat_map do |msg|
msg.deltas.map { |d| Gitlab::Git::Diff.new(d) } msg.deltas.map { |d| Gitlab::Git::Diff.new(d) }
end end
...@@ -44,7 +44,7 @@ module Gitlab ...@@ -44,7 +44,7 @@ module Gitlab
limit: limit.to_i limit: limit.to_i
) )
response = GitalyClient.call(@repository.storage, :commit, :tree_entry, request) response = GitalyClient.call(@repository.storage, :commit_service, :tree_entry, request)
entry = response.first entry = response.first
return unless entry.oid.present? return unless entry.oid.present?
......
module Gitlab module Gitlab
module GitalyClient module GitalyClient
class Notifications class NotificationService
# 'repository' is a Gitlab::Git::Repository # 'repository' is a Gitlab::Git::Repository
def initialize(repository) def initialize(repository)
@gitaly_repo = repository.gitaly_repository @gitaly_repo = repository.gitaly_repository
...@@ -10,7 +10,7 @@ module Gitlab ...@@ -10,7 +10,7 @@ module Gitlab
def post_receive def post_receive
GitalyClient.call( GitalyClient.call(
@storage, @storage,
:notifications, :notification_service,
:post_receive, :post_receive,
Gitaly::PostReceiveRequest.new(repository: @gitaly_repo) Gitaly::PostReceiveRequest.new(repository: @gitaly_repo)
) )
......
module Gitlab module Gitlab
module GitalyClient module GitalyClient
class Ref class RefService
include Gitlab::EncodingHelper include Gitlab::EncodingHelper
# 'repository' is a Gitlab::Git::Repository # 'repository' is a Gitlab::Git::Repository
...@@ -12,19 +12,19 @@ module Gitlab ...@@ -12,19 +12,19 @@ module Gitlab
def default_branch_name def default_branch_name
request = Gitaly::FindDefaultBranchNameRequest.new(repository: @gitaly_repo) request = Gitaly::FindDefaultBranchNameRequest.new(repository: @gitaly_repo)
response = GitalyClient.call(@storage, :ref, :find_default_branch_name, request) response = GitalyClient.call(@storage, :ref_service, :find_default_branch_name, request)
Gitlab::Git.branch_name(response.name) Gitlab::Git.branch_name(response.name)
end end
def branch_names def branch_names
request = Gitaly::FindAllBranchNamesRequest.new(repository: @gitaly_repo) request = Gitaly::FindAllBranchNamesRequest.new(repository: @gitaly_repo)
response = GitalyClient.call(@storage, :ref, :find_all_branch_names, request) response = GitalyClient.call(@storage, :ref_service, :find_all_branch_names, request)
consume_refs_response(response) { |name| Gitlab::Git.branch_name(name) } consume_refs_response(response) { |name| Gitlab::Git.branch_name(name) }
end end
def tag_names def tag_names
request = Gitaly::FindAllTagNamesRequest.new(repository: @gitaly_repo) request = Gitaly::FindAllTagNamesRequest.new(repository: @gitaly_repo)
response = GitalyClient.call(@storage, :ref, :find_all_tag_names, request) response = GitalyClient.call(@storage, :ref_service, :find_all_tag_names, request)
consume_refs_response(response) { |name| Gitlab::Git.tag_name(name) } consume_refs_response(response) { |name| Gitlab::Git.tag_name(name) }
end end
...@@ -34,7 +34,7 @@ module Gitlab ...@@ -34,7 +34,7 @@ module Gitlab
commit_id: commit_id, commit_id: commit_id,
prefix: ref_prefix prefix: ref_prefix
) )
encode!(GitalyClient.call(@storage, :ref, :find_ref_name, request).name.dup) encode!(GitalyClient.call(@storage, :ref_service, :find_ref_name, request).name.dup)
end end
def count_tag_names def count_tag_names
...@@ -48,7 +48,7 @@ module Gitlab ...@@ -48,7 +48,7 @@ module Gitlab
def local_branches(sort_by: nil) def local_branches(sort_by: nil)
request = Gitaly::FindLocalBranchesRequest.new(repository: @gitaly_repo) request = Gitaly::FindLocalBranchesRequest.new(repository: @gitaly_repo)
request.sort_by = sort_by_param(sort_by) if sort_by request.sort_by = sort_by_param(sort_by) if sort_by
response = GitalyClient.call(@storage, :ref, :find_local_branches, request) response = GitalyClient.call(@storage, :ref_service, :find_local_branches, request)
consume_branches_response(response) consume_branches_response(response)
end end
......
...@@ -45,11 +45,11 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -45,11 +45,11 @@ describe Gitlab::Git::Repository, seed_helper: true do
end end
it 'gets the branch name from GitalyClient' do it 'gets the branch name from GitalyClient' do
expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:default_branch_name) expect_any_instance_of(Gitlab::GitalyClient::RefService).to receive(:default_branch_name)
repository.root_ref repository.root_ref
end end
it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::Ref, :default_branch_name do it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::RefService, :default_branch_name do
subject { repository.root_ref } subject { repository.root_ref }
end end
end end
...@@ -132,11 +132,11 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -132,11 +132,11 @@ describe Gitlab::Git::Repository, seed_helper: true do
it { is_expected.not_to include("branch-from-space") } it { is_expected.not_to include("branch-from-space") }
it 'gets the branch names from GitalyClient' do it 'gets the branch names from GitalyClient' do
expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:branch_names) expect_any_instance_of(Gitlab::GitalyClient::RefService).to receive(:branch_names)
subject subject
end end
it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::Ref, :branch_names it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::RefService, :branch_names
end end
describe '#tag_names' do describe '#tag_names' do
...@@ -160,11 +160,11 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -160,11 +160,11 @@ describe Gitlab::Git::Repository, seed_helper: true do
it { is_expected.not_to include("v5.0.0") } it { is_expected.not_to include("v5.0.0") }
it 'gets the tag names from GitalyClient' do it 'gets the tag names from GitalyClient' do
expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:tag_names) expect_any_instance_of(Gitlab::GitalyClient::RefService).to receive(:tag_names)
subject subject
end end
it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::Ref, :tag_names it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::RefService, :tag_names
end end
shared_examples 'archive check' do |extenstion| shared_examples 'archive check' do |extenstion|
...@@ -368,7 +368,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -368,7 +368,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
context 'when Gitaly commit_count feature is enabled' do context 'when Gitaly commit_count feature is enabled' do
it_behaves_like 'counting commits' it_behaves_like 'counting commits'
it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::Commit, :commit_count do it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::CommitService, :commit_count do
subject { repository.commit_count('master') } subject { repository.commit_count('master') }
end end
end end
...@@ -1225,12 +1225,12 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -1225,12 +1225,12 @@ describe Gitlab::Git::Repository, seed_helper: true do
end end
it 'gets the branches from GitalyClient' do it 'gets the branches from GitalyClient' do
expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:local_branches) expect_any_instance_of(Gitlab::GitalyClient::RefService).to receive(:local_branches)
.and_return([]) .and_return([])
@repo.local_branches @repo.local_branches
end end
it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::Ref, :local_branches do it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::RefService, :local_branches do
subject { @repo.local_branches } subject { @repo.local_branches }
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::GitalyClient::Commit do describe Gitlab::GitalyClient::CommitService do
let(:diff_stub) { double('Gitaly::Diff::Stub') } let(:diff_stub) { double('Gitaly::DiffService::Stub') }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:repository) { project.repository } let(:repository) { project.repository }
let(:repository_message) { repository.gitaly_repository } let(:repository_message) { repository.gitaly_repository }
...@@ -16,7 +16,7 @@ describe Gitlab::GitalyClient::Commit do ...@@ -16,7 +16,7 @@ describe Gitlab::GitalyClient::Commit do
right_commit_id: commit.id right_commit_id: commit.id
) )
expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request, kind_of(Hash)) expect_any_instance_of(Gitaly::DiffService::Stub).to receive(:commit_diff).with(request, kind_of(Hash))
described_class.new(repository).diff_from_parent(commit) described_class.new(repository).diff_from_parent(commit)
end end
...@@ -31,7 +31,7 @@ describe Gitlab::GitalyClient::Commit do ...@@ -31,7 +31,7 @@ describe Gitlab::GitalyClient::Commit do
right_commit_id: initial_commit.id right_commit_id: initial_commit.id
) )
expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_diff).with(request, kind_of(Hash)) expect_any_instance_of(Gitaly::DiffService::Stub).to receive(:commit_diff).with(request, kind_of(Hash))
described_class.new(repository).diff_from_parent(initial_commit) described_class.new(repository).diff_from_parent(initial_commit)
end end
...@@ -61,7 +61,7 @@ describe Gitlab::GitalyClient::Commit do ...@@ -61,7 +61,7 @@ describe Gitlab::GitalyClient::Commit do
right_commit_id: commit.id right_commit_id: commit.id
) )
expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_delta).with(request, kind_of(Hash)).and_return([]) expect_any_instance_of(Gitaly::DiffService::Stub).to receive(:commit_delta).with(request, kind_of(Hash)).and_return([])
described_class.new(repository).commit_deltas(commit) described_class.new(repository).commit_deltas(commit)
end end
...@@ -76,7 +76,7 @@ describe Gitlab::GitalyClient::Commit do ...@@ -76,7 +76,7 @@ describe Gitlab::GitalyClient::Commit do
right_commit_id: initial_commit.id right_commit_id: initial_commit.id
) )
expect_any_instance_of(Gitaly::Diff::Stub).to receive(:commit_delta).with(request, kind_of(Hash)).and_return([]) expect_any_instance_of(Gitaly::DiffService::Stub).to receive(:commit_delta).with(request, kind_of(Hash)).and_return([])
described_class.new(repository).commit_deltas(initial_commit) described_class.new(repository).commit_deltas(initial_commit)
end end
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::GitalyClient::Notifications do describe Gitlab::GitalyClient::NotificationService do
describe '#post_receive' do describe '#post_receive' do
let(:project) { create(:empty_project) } let(:project) { create(:empty_project) }
let(:storage_name) { project.repository_storage } let(:storage_name) { project.repository_storage }
...@@ -8,7 +8,7 @@ describe Gitlab::GitalyClient::Notifications do ...@@ -8,7 +8,7 @@ describe Gitlab::GitalyClient::Notifications do
subject { described_class.new(project.repository) } subject { described_class.new(project.repository) }
it 'sends a post_receive message' do it 'sends a post_receive message' do
expect_any_instance_of(Gitaly::Notifications::Stub) expect_any_instance_of(Gitaly::NotificationService::Stub)
.to receive(:post_receive).with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) .to receive(:post_receive).with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash))
subject.post_receive subject.post_receive
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::GitalyClient::Ref do describe Gitlab::GitalyClient::RefService do
let(:project) { create(:empty_project) } let(:project) { create(:empty_project) }
let(:storage_name) { project.repository_storage } let(:storage_name) { project.repository_storage }
let(:relative_path) { project.path_with_namespace + '.git' } let(:relative_path) { project.path_with_namespace + '.git' }
...@@ -8,7 +8,7 @@ describe Gitlab::GitalyClient::Ref do ...@@ -8,7 +8,7 @@ describe Gitlab::GitalyClient::Ref do
describe '#branch_names' do describe '#branch_names' do
it 'sends a find_all_branch_names message' do it 'sends a find_all_branch_names message' do
expect_any_instance_of(Gitaly::Ref::Stub) expect_any_instance_of(Gitaly::RefService::Stub)
.to receive(:find_all_branch_names) .to receive(:find_all_branch_names)
.with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash))
.and_return([]) .and_return([])
...@@ -19,7 +19,7 @@ describe Gitlab::GitalyClient::Ref do ...@@ -19,7 +19,7 @@ describe Gitlab::GitalyClient::Ref do
describe '#tag_names' do describe '#tag_names' do
it 'sends a find_all_tag_names message' do it 'sends a find_all_tag_names message' do
expect_any_instance_of(Gitaly::Ref::Stub) expect_any_instance_of(Gitaly::RefService::Stub)
.to receive(:find_all_tag_names) .to receive(:find_all_tag_names)
.with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash))
.and_return([]) .and_return([])
...@@ -30,7 +30,7 @@ describe Gitlab::GitalyClient::Ref do ...@@ -30,7 +30,7 @@ describe Gitlab::GitalyClient::Ref do
describe '#default_branch_name' do describe '#default_branch_name' do
it 'sends a find_default_branch_name message' do it 'sends a find_default_branch_name message' do
expect_any_instance_of(Gitaly::Ref::Stub) expect_any_instance_of(Gitaly::RefService::Stub)
.to receive(:find_default_branch_name) .to receive(:find_default_branch_name)
.with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash))
.and_return(double(name: 'foo')) .and_return(double(name: 'foo'))
...@@ -41,7 +41,7 @@ describe Gitlab::GitalyClient::Ref do ...@@ -41,7 +41,7 @@ describe Gitlab::GitalyClient::Ref do
describe '#local_branches' do describe '#local_branches' do
it 'sends a find_local_branches message' do it 'sends a find_local_branches message' do
expect_any_instance_of(Gitaly::Ref::Stub) expect_any_instance_of(Gitaly::RefService::Stub)
.to receive(:find_local_branches) .to receive(:find_local_branches)
.with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash))
.and_return([]) .and_return([])
...@@ -50,7 +50,7 @@ describe Gitlab::GitalyClient::Ref do ...@@ -50,7 +50,7 @@ describe Gitlab::GitalyClient::Ref do
end end
it 'parses and sends the sort parameter' do it 'parses and sends the sort parameter' do
expect_any_instance_of(Gitaly::Ref::Stub) expect_any_instance_of(Gitaly::RefService::Stub)
.to receive(:find_local_branches) .to receive(:find_local_branches)
.with(gitaly_request_with_params(sort_by: :UPDATED_DESC), kind_of(Hash)) .with(gitaly_request_with_params(sort_by: :UPDATED_DESC), kind_of(Hash))
.and_return([]) .and_return([])
...@@ -59,7 +59,7 @@ describe Gitlab::GitalyClient::Ref do ...@@ -59,7 +59,7 @@ describe Gitlab::GitalyClient::Ref do
end end
it 'translates known mismatches on sort param values' do it 'translates known mismatches on sort param values' do
expect_any_instance_of(Gitaly::Ref::Stub) expect_any_instance_of(Gitaly::RefService::Stub)
.to receive(:find_local_branches) .to receive(:find_local_branches)
.with(gitaly_request_with_params(sort_by: :NAME), kind_of(Hash)) .with(gitaly_request_with_params(sort_by: :NAME), kind_of(Hash))
.and_return([]) .and_return([])
......
...@@ -16,9 +16,9 @@ describe Gitlab::GitalyClient, lib: true, skip_gitaly_mock: true do ...@@ -16,9 +16,9 @@ describe Gitlab::GitalyClient, lib: true, skip_gitaly_mock: true do
'default' => { 'gitaly_address' => address } 'default' => { 'gitaly_address' => address }
}) })
expect(Gitaly::Commit::Stub).to receive(:new).with(address, any_args) expect(Gitaly::CommitService::Stub).to receive(:new).with(address, any_args)
described_class.stub(:commit, 'default') described_class.stub(:commit_service, 'default')
end end
end end
...@@ -31,9 +31,9 @@ describe Gitlab::GitalyClient, lib: true, skip_gitaly_mock: true do ...@@ -31,9 +31,9 @@ describe Gitlab::GitalyClient, lib: true, skip_gitaly_mock: true do
'default' => { 'gitaly_address' => prefixed_address } 'default' => { 'gitaly_address' => prefixed_address }
}) })
expect(Gitaly::Commit::Stub).to receive(:new).with(address, any_args) expect(Gitaly::CommitService::Stub).to receive(:new).with(address, any_args)
described_class.stub(:commit, 'default') described_class.stub(:commit_service, 'default')
end end
end end
end end
......
...@@ -594,10 +594,10 @@ describe API::Internal do ...@@ -594,10 +594,10 @@ describe API::Internal do
# end # end
# #
# it "calls the Gitaly client with the project's repository" do # it "calls the Gitaly client with the project's repository" do
# expect(Gitlab::GitalyClient::Notifications). # expect(Gitlab::GitalyClient::NotificationService).
# to receive(:new).with(gitlab_git_repository_with(path: project.repository.path)). # to receive(:new).with(gitlab_git_repository_with(path: project.repository.path)).
# and_call_original # and_call_original
# expect_any_instance_of(Gitlab::GitalyClient::Notifications). # expect_any_instance_of(Gitlab::GitalyClient::NotificationService).
# to receive(:post_receive) # to receive(:post_receive)
# #
# post api("/internal/notify_post_receive"), valid_params # post api("/internal/notify_post_receive"), valid_params
...@@ -606,10 +606,10 @@ describe API::Internal do ...@@ -606,10 +606,10 @@ describe API::Internal do
# end # end
# #
# it "calls the Gitaly client with the wiki's repository if it's a wiki" do # it "calls the Gitaly client with the wiki's repository if it's a wiki" do
# expect(Gitlab::GitalyClient::Notifications). # expect(Gitlab::GitalyClient::NotificationService).
# to receive(:new).with(gitlab_git_repository_with(path: project.wiki.repository.path)). # to receive(:new).with(gitlab_git_repository_with(path: project.wiki.repository.path)).
# and_call_original # and_call_original
# expect_any_instance_of(Gitlab::GitalyClient::Notifications). # expect_any_instance_of(Gitlab::GitalyClient::NotificationService).
# to receive(:post_receive) # to receive(:post_receive)
# #
# post api("/internal/notify_post_receive"), valid_wiki_params # post api("/internal/notify_post_receive"), valid_wiki_params
...@@ -618,7 +618,7 @@ describe API::Internal do ...@@ -618,7 +618,7 @@ describe API::Internal do
# end # end
# #
# it "returns 500 if the gitaly call fails" do # it "returns 500 if the gitaly call fails" do
# expect_any_instance_of(Gitlab::GitalyClient::Notifications). # expect_any_instance_of(Gitlab::GitalyClient::NotificationService).
# to receive(:post_receive).and_raise(GRPC::Unavailable) # to receive(:post_receive).and_raise(GRPC::Unavailable)
# #
# post api("/internal/notify_post_receive"), valid_params # post api("/internal/notify_post_receive"), valid_params
...@@ -636,10 +636,10 @@ describe API::Internal do ...@@ -636,10 +636,10 @@ describe API::Internal do
# end # end
# #
# it "calls the Gitaly client with the project's repository" do # it "calls the Gitaly client with the project's repository" do
# expect(Gitlab::GitalyClient::Notifications). # expect(Gitlab::GitalyClient::NotificationService).
# to receive(:new).with(gitlab_git_repository_with(path: project.repository.path)). # to receive(:new).with(gitlab_git_repository_with(path: project.repository.path)).
# and_call_original # and_call_original
# expect_any_instance_of(Gitlab::GitalyClient::Notifications). # expect_any_instance_of(Gitlab::GitalyClient::NotificationService).
# to receive(:post_receive) # to receive(:post_receive)
# #
# post api("/internal/notify_post_receive"), valid_params # post api("/internal/notify_post_receive"), valid_params
...@@ -648,10 +648,10 @@ describe API::Internal do ...@@ -648,10 +648,10 @@ describe API::Internal do
# end # end
# #
# it "calls the Gitaly client with the wiki's repository if it's a wiki" do # it "calls the Gitaly client with the wiki's repository if it's a wiki" do
# expect(Gitlab::GitalyClient::Notifications). # expect(Gitlab::GitalyClient::NotificationService).
# to receive(:new).with(gitlab_git_repository_with(path: project.wiki.repository.path)). # to receive(:new).with(gitlab_git_repository_with(path: project.wiki.repository.path)).
# and_call_original # and_call_original
# expect_any_instance_of(Gitlab::GitalyClient::Notifications). # expect_any_instance_of(Gitlab::GitalyClient::NotificationService).
# to receive(:post_receive) # to receive(:post_receive)
# #
# post api("/internal/notify_post_receive"), valid_wiki_params # post api("/internal/notify_post_receive"), valid_wiki_params
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment