Commit e3b07c65 authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'ml-add-logging-for-push-option-failures' into 'master'

Add error logging to help troubleshoot push option e2e test failures

See merge request gitlab-org/gitlab!74664
parents 4f45de07 8dc92f67
...@@ -4,7 +4,7 @@ module QA ...@@ -4,7 +4,7 @@ module QA
module Resource module Resource
module Events module Events
MAX_WAIT = 60 MAX_WAIT = 60
RAISE_ON_FAILURE = true RAISE_ON_FAILURE = false
EventNotFoundError = Class.new(RuntimeError) EventNotFoundError = Class.new(RuntimeError)
......
...@@ -25,6 +25,10 @@ module QA ...@@ -25,6 +25,10 @@ module QA
wait_for_event do wait_for_event do
events(action: 'pushed').any? { |event| event.dig(:push_data, :commit_title) == commit_message } events(action: 'pushed').any? { |event| event.dig(:push_data, :commit_title) == commit_message }
end end
rescue EventNotFoundError
QA::Runtime::Logger.debug("Push events: #{events(action: 'pushed')}")
raise
end end
def wait_for_push_new_branch(branch_name = self.default_branch) def wait_for_push_new_branch(branch_name = self.default_branch)
......
...@@ -25,8 +25,9 @@ module QA ...@@ -25,8 +25,9 @@ module QA
end end
end end
after do after do |example|
runner.remove_via_api! runner.remove_via_api!
project.remove_via_api! unless example.exception
end end
it 'sets merge when pipeline succeeds', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1240' do it 'sets merge when pipeline succeeds', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1240' do
...@@ -106,15 +107,22 @@ module QA ...@@ -106,15 +107,22 @@ module QA
expect(merge_request).not_to be_nil, "There was a problem creating the merge request" expect(merge_request).not_to be_nil, "There was a problem creating the merge request"
expect(merge_request[:merge_when_pipeline_succeeds]).to be true expect(merge_request[:merge_when_pipeline_succeeds]).to be true
merge_request = Support::Waiter.wait_until(sleep_interval: 5) do mr = nil
mr = Resource::MergeRequest.fabricate_via_api! do |mr| begin
mr.project = project merge_request = Support::Retrier.retry_until(max_duration: 60, sleep_interval: 5, message: 'The merge request was not merged') do
mr.iid = merge_request[:iid] mr = Resource::MergeRequest.fabricate_via_api! do |mr|
end mr.project = project
mr.iid = merge_request[:iid]
end
next unless mr.state == 'merged'
next unless mr.state == 'merged' mr
end
rescue Support::Repeater::WaitExceededError
QA::Runtime::Logger.debug("MR: #{mr.api_response}")
mr raise
end end
expect(merge_request.state).to eq('merged') expect(merge_request.state).to eq('merged')
......
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