As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Commit ac8bbb95 authored by Mayra Cabrera's avatar Mayra Cabrera
Browse files

Prints a message if project was redirected

parent 76e75549
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -25,9 +25,9 @@ class GitlabPostReceive
end
return false unless response
print_broadcast_message(response['broadcast_message']) if response['broadcast_message']
print_merge_request_links(response['merge_request_urls']) if response['merge_request_urls']
puts response['redirected_message'] if response['redirected_message']
response['reference_counter_decreased']
rescue GitlabNet::ApiUnreachableError
Loading
Loading
Loading
Loading
@@ -206,6 +206,30 @@ describe GitlabPostReceive do
expect(gitlab_post_receive.exec).to eq(true)
end
end
context 'when redirected message available' do
let(:message) do
<<-MSG
Project 'foo/bar' was moved to 'foo/baz'.
Please update your Git remote:
git remote set-url origin http://localhost:3000/foo/baz.git
MSG
end
let(:response) do
{
'reference_counter_decreased' => true,
'redirected_message' => message
}
end
it 'prints redirected message' do
expect_any_instance_of(GitlabNet).to receive(:post_receive).and_return(response)
assert_redirected_message_printed(gitlab_post_receive)
expect(gitlab_post_receive.exec).to eq(true)
end
end
end
end
Loading
Loading
@@ -252,4 +276,15 @@ describe GitlabPostReceive do
"========================================================================"
).ordered
end
def assert_redirected_message_printed(gitlab_post_receive)
message = <<-MSG
Project 'foo/bar' was moved to 'foo/baz'.
Please update your Git remote:
git remote set-url origin http://localhost:3000/foo/baz.git
MSG
expect(gitlab_post_receive).to receive(:puts).with(message).ordered
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment