Commit c18c428c authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'ml-improve-flaky-tests' into 'master'

Wait for branch protection before removing it

See merge request gitlab-org/gitlab!80985
parents 3c419ef1 3be8d15e
...@@ -72,6 +72,16 @@ module QA ...@@ -72,6 +72,16 @@ module QA
self.remove_via_api!(&block) self.remove_via_api!(&block)
end end
# Remove the branch protection after confirming that it exists
def remove_via_api!
Support::Retrier.retry_until(max_duration: 60, sleep_interval: 1, message: "Waiting for branch #{branch_name} to be protected") do
# We confirm it exists before removal because there's no creation event when the default branch is automatically protected by GitLab itself, and there's a slight delay between creating the repo and protecting the default branch
exists?
end
super
end
def api_get_path def api_get_path
"/projects/#{project.id}/protected_branches/#{branch_name}" "/projects/#{project.id}/protected_branches/#{branch_name}"
end end
......
...@@ -4,7 +4,9 @@ module QA ...@@ -4,7 +4,9 @@ module QA
RSpec.describe 'Create', :requires_admin do RSpec.describe 'Create', :requires_admin do
describe 'Setup an MR with codeowners file' do describe 'Setup an MR with codeowners file' do
let(:project) do let(:project) do
Resource::Project.fabricate_via_api! Resource::Project.fabricate_via_api! do |project|
project.initialize_with_readme = true
end
end end
let!(:target) do let!(:target) do
......
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