Commit e569481a authored by Mark Lapierre's avatar Mark Lapierre

Add transient bug version of MWPS test

parent 9c35c043
...@@ -29,7 +29,7 @@ module QA ...@@ -29,7 +29,7 @@ module QA
content: <<~EOF content: <<~EOF
test: test:
tags: ["runner-for-#{project.name}"] tags: ["runner-for-#{project.name}"]
script: sleep 5 script: sleep 10
only: only:
- merge_requests - merge_requests
EOF EOF
...@@ -47,36 +47,50 @@ module QA ...@@ -47,36 +47,50 @@ module QA
end end
it 'merges when pipeline succeeds', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1684' do it 'merges when pipeline succeeds', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1684' do
branch_name = "merge-request-test-#{SecureRandom.hex(8)}" verify_merge_when_pipeline_succeeds
end
# Create a branch that will be merged into the default branch it 'reliably merges when pipeline succeeds', :transient, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1684' do
Resource::Repository::ProjectPush.fabricate! do |project_push| verify_merge_when_pipeline_succeeds(repeat: Runtime::Env.transient_trials) do |i|
project_push.project = project QA::Runtime::Logger.info("Transient bug test - Trial #{i}")
project_push.new_branch = true
project_push.branch_name = branch_name
project_push.file_name = "file-#{SecureRandom.hex(8)}.txt"
end end
end
# Create a merge request to merge the branch we just created def verify_merge_when_pipeline_succeeds(repeat: 1)
merge_request = Resource::MergeRequest.fabricate_via_api! do |merge_request| repeat.times do |i|
merge_request.project = project yield i if block_given?
merge_request.source_branch = branch_name
merge_request.no_preparation = true
end
merge_request.visit! branch_name = "merge-request-test-#{SecureRandom.hex(8)}"
Page::MergeRequest::Show.perform do |mr| # Create a branch that will be merged into the default branch
mr.merge_when_pipeline_succeeds! Resource::Repository::ProjectPush.fabricate! do |project_push|
project_push.project = project
project_push.new_branch = true
project_push.branch_name = branch_name
project_push.file_name = "file-#{SecureRandom.hex(8)}.txt"
end
Support::Waiter.wait_until(sleep_interval: 5) do # Create a merge request to merge the branch we just created
merge_request = merge_request.reload! merge_request = Resource::MergeRequest.fabricate_via_api! do |merge_request|
merge_request.state == 'merged' merge_request.project = project
merge_request.source_branch = branch_name
merge_request.no_preparation = true
end end
aggregate_failures do merge_request.visit!
expect(merge_request.merge_when_pipeline_succeeds).to be_truthy
expect(mr.merged?).to be_truthy, "Expected content 'The changes were merged' but it did not appear." Page::MergeRequest::Show.perform do |mr|
mr.merge_when_pipeline_succeeds!
Support::Waiter.wait_until(sleep_interval: 5) do
merge_request = merge_request.reload!
merge_request.state == 'merged'
end
aggregate_failures do
expect(merge_request.merge_when_pipeline_succeeds).to be_truthy
expect(mr.merged?).to be_truthy, "Expected content 'The changes were merged' but it did not appear."
end
end end
end end
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