Skip to content
代码片段 群组 项目
提交 baaa1538 编辑于 作者: Chloe Liu's avatar Chloe Liu
浏览文件

Merge branch 'ml-fix-merge-via-api' into 'master'

Use detailed_merge_status in E2E tests instead of merge_status

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/121478



Merged-by: default avatarChloe Liu <yliu@gitlab.com>
Approved-by: default avatarHarsha Muralidhar <hmuralidhar@gitlab.com>
Approved-by: default avatarChloe Liu <yliu@gitlab.com>
Reviewed-by: default avatarMark Lapierre <mlapierre@gitlab.com>
Co-authored-by: default avatarMark Lapierre <mlapierre@gitlab.com>
分支
标签
无相关合并请求
......@@ -24,7 +24,7 @@ class MergeRequest < Issuable
:title,
:description,
:merge_when_pipeline_succeeds,
:merge_status,
:detailed_merge_status,
:state,
:reviewers
......@@ -151,13 +151,11 @@ def reviews
end
def merge_via_api!
Support::Waiter.wait_until(sleep_interval: 1) do
QA::Runtime::Logger.debug("Waiting until merge request with id '#{iid}' can be merged")
QA::Runtime::Logger.info("Merging via PUT #{api_merge_path}")
reload!.merge_status == 'can_be_merged'
end
wait_until_mergable
Support::Retrier.retry_on_exception do
Support::Retrier.retry_on_exception(max_attempts: 10, sleep_interval: 5) do
response = put(Runtime::API::Request.new(api_client, api_merge_path).url)
unless response.code == HTTP_STATUS_OK
......@@ -205,7 +203,7 @@ def comparable
:project_id,
:source_project_id,
:target_project_id,
:merge_status,
:detailed_merge_status,
# we consider mr to still be the same even if users changed
:author,
:reviewers,
......@@ -250,6 +248,18 @@ def populate_target_and_source_if_required
def create_target?
!(project.initialize_with_readme && target_branch == project.default_branch) && target_new_branch
end
# Wait until the merge request can be merged. Raises WaitExceededError if the MR can't be merged within 60 seconds
#
# @return [void]
def wait_until_mergable
return if Support::Waiter.wait_until(sleep_interval: 1, raise_on_failure: false, log: false) do
reload!.detailed_merge_status == 'mergeable'
end
raise Support::Repeater::WaitExceededError,
"Timed out waiting for merge of MR with id '#{iid}'. Final status was '#{detailed_merge_status}'"
end
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
想要评论请 注册