Commit d29eb15a authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho

Merge branch 'ml-update-git-repository-method' into 'master'

Update `Git::Repository` to handle changes made while a test was disabled

See merge request gitlab-org/gitlab!25496
parents e38712a8 f479168b
......@@ -165,7 +165,7 @@ module QA
# ls-remote is one command known to respond to Git protocol v2 so we use
# it to get output including the version reported via Git tracing
output = run("git ls-remote #{uri}", "GIT_TRACE_PACKET=1")
output[/git< version (\d+)/, 1] || 'unknown'
output.response[/git< version (\d+)/, 1] || 'unknown'
end
def try_add_credentials_to_netrc
......
......@@ -69,18 +69,20 @@ describe QA::Git::Repository do
end
describe '#fetch_supported_git_protocol' do
Result = Struct.new(:response)
it "reports the detected version" do
expect(repository).to receive(:run).and_return("packet: git< version 2")
expect(repository).to receive(:run).and_return(Result.new("packet: git< version 2"))
expect(repository.fetch_supported_git_protocol).to eq('2')
end
it 'reports unknown if version is unknown' do
expect(repository).to receive(:run).and_return("packet: git< version -1")
expect(repository).to receive(:run).and_return(Result.new("packet: git< version -1"))
expect(repository.fetch_supported_git_protocol).to eq('unknown')
end
it 'reports unknown if content does not identify a version' do
expect(repository).to receive(:run).and_return("foo")
expect(repository).to receive(:run).and_return(Result.new("foo"))
expect(repository.fetch_supported_git_protocol).to eq('unknown')
end
end
......
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