Commit 8735335b authored by Dan Davison's avatar Dan Davison

Merge branch 'ml-update-transient-bug-mwps-test' into 'master'

Refactor and update MWPS e2e test after CR

See merge request gitlab-org/gitlab!59440
parents 1fd3674a 8eb2c4b0
......@@ -3,6 +3,7 @@
module QA
RSpec.describe 'Create', :runner do
describe 'Merge requests' do
shared_examples 'merge when pipeline succeeds' do |repeat: 1|
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'merge-when-pipeline-succeeds'
......@@ -46,28 +47,18 @@ module QA
project&.remove_via_api!
end
it 'merges when pipeline succeeds', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1684' do
verify_merge_when_pipeline_succeeds
end
it 'reliably merges when pipeline succeeds', :transient, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1684' do
verify_merge_when_pipeline_succeeds(repeat: Runtime::Env.transient_trials) do |i|
QA::Runtime::Logger.info("Transient bug test - Trial #{i}")
end
end
def verify_merge_when_pipeline_succeeds(repeat: 1)
it 'merges after pipeline succeeds' do
repeat.times do |i|
yield i if block_given?
QA::Runtime::Logger.info("Transient bug test - Trial #{i}") if repeat > 1
branch_name = "merge-request-test-#{SecureRandom.hex(8)}"
branch_name = "mr-test-#{SecureRandom.hex(6)}-#{i}"
# Create a branch that will be merged into the default branch
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"
project_push.file_name = "#{branch_name}.txt"
end
# Create a merge request to merge the branch we just created
......@@ -95,5 +86,14 @@ module QA
end
end
end
context 'when merging once', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1684' do
it_behaves_like 'merge when pipeline succeeds'
end
context 'when merging several times', :transient, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1684' do
it_behaves_like 'merge when pipeline succeeds', repeat: Runtime::Env.transient_trials
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