Add calculate_checksum method to the Gitaly repository client

This commit is contained in:
Douglas Barbosa Alexandre 2018-04-05 15:27:09 -03:00
parent b81c6f142c
commit e892eeb546
No known key found for this signature in database
GPG key ID: F1E98EF6393565A0
2 changed files with 17 additions and 0 deletions

View file

@ -262,6 +262,12 @@ module Gitlab
response.license_short_name.presence
end
def calculate_checksum
request = Gitaly::CalculateChecksumRequest.new(repository: @gitaly_repo)
response = GitalyClient.call(@storage, :repository_service, :calculate_checksum, request)
response.checksum.presence
end
end
end
end

View file

@ -134,4 +134,15 @@ describe Gitlab::GitalyClient::RepositoryService do
client.squash_in_progress?(squash_id)
end
end
describe '#calculate_checksum' do
it 'sends a calculate_checksum message' do
expect_any_instance_of(Gitaly::RepositoryService::Stub)
.to receive(:calculate_checksum)
.with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash))
.and_return(double(checksum: 0))
client.calculate_checksum
end
end
end