Commit efdb7f7a authored by Nick Thomas's avatar Nick Thomas

Remove an ineffective wait-loop in a QA spec

This code was added to try to prevent a "branch not found" error when
processing push options. However, this is literally a race condition in
the application that needs to be fixed, rather than something to work
around.

Additionally, the git clone operation used bypasses all the caching in
the Rails application, so is not a useful check. If we wanted to keep
this check, we could loop around `QA::Resource::Project.has_branch?`
instead, but it's much better to do without it.
parent 8ab5d0db
......@@ -24,7 +24,7 @@ class PostReceiveService
# The PostReceive worker will normally invalidate the cache. However, it
# runs asynchronously. If push options require us to create a new merge
# request synchronously, we can't rely on that, so invalidate the cache here
repository&.expire_branches_cache if mr_options&.key?(:create)
repository&.expire_branches_cache if mr_options&.fetch(:create, false)
PostReceive.perform_async(params[:gl_repository], params[:identifier],
params[:changes], push_options.as_json)
......
......@@ -25,18 +25,6 @@ module QA
push.file_content = "Target branch test target branch #{SecureRandom.hex(8)}"
end
# Confirm the target branch can be checked out to avoid a race condition
# where the subsequent push option attempts to create an MR before the target branch is ready.
Support::Retrier.retry_on_exception(sleep_interval: 5) do
Git::Repository.perform do |repository|
repository.uri = project.repository_http_location.uri
repository.use_default_credentials
repository.clone
repository.configure_identity('GitLab QA', 'root@gitlab.com')
repository.checkout(target_branch)
end
end
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.branch_name = "push-options-test-#{SecureRandom.hex(8)}"
......
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