Repository navigation
Summarize unmet Mergify candidate conditions on timeout #1486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4453,22 +4453,22 @@ def test_mergify_reports_current_queue_attempt(wt, gh, capsys, monkeypatch, conf | |
| assert (f"{URL}#issuecomment-43" in out) is (kind == "current") | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("result", ["blocking", "neutral", "skipped", None]) | ||
| @pytest.mark.parametrize("result", ["blocking", "neutral", "skipped", None, "long", "many"]) | ||
| def test_mergify_timeout_reports_evaluated_candidate_conditions(wt, gh, capsys, monkeypatch, result): | ||
| head = commit_mergify_configuration(wt) | ||
| arm_approved_ready_pr(gh, head, wt, isDraft=False) | ||
| monkeypatch.setattr(mergify, "configured", lambda *_: True) | ||
| monkeypatch.setattr(mergify, "markers", lambda *_: (True, False)) | ||
| monkeypatch.setattr(mergify, "mark_confirmed", lambda *_: None) | ||
| responses = iter([None, MERGIFY_QUEUE_FIXTURE["candidate_responses"][result or "missing"]]) | ||
| monkeypatch.setattr(mergify, "api_get", lambda *_: next(responses)) | ||
|
|
||
| monkeypatch.setattr(mergify, "markers", lambda *_: (True, True)) | ||
| payload = MERGIFY_QUEUE_FIXTURE["candidate_responses"]["blocking" if result in {"long", "many"} else result or "missing"] | ||
| if extra := {"long": 1, "many": 30}.get(result, 0): | ||
| conditions = payload["mergeability_check"]["conditions_evaluation"] | ||
| monkeypatch.setitem(conditions, "subconditions", conditions["subconditions"] + [{"match": False, "label": "界" * 3000}] * extra) | ||
| monkeypatch.setattr(mergify, "api_get", lambda *_: payload) | ||
| code, out, err = run(capsys, "merge", "--wait=0") | ||
|
|
||
| assert (code, err) == (3, "") | ||
| assert f"https://github.com/{REPO}/pull/42" in out | ||
| assert (MERGIFY_QUEUE_FIXTURE["candidate_condition"] in out) is (result == "blocking") | ||
| assert (code, err) == (3, "") and f"https://github.com/{REPO}/pull/42" in out | ||
| assert (MERGIFY_QUEUE_FIXTURE["candidate_condition"] in out) == (result in {"blocking", "long", "many"}) | ||
| assert "failed" not in out and "check-success = checks" not in out | ||
| assert len(out.encode()) < 2048 and ("27 more" in out) == (extra == 30) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Check that the oversized condition has a visible preview In the |
||
|
|
||
|
|
||
| @pytest.mark.parametrize("queue_state", ["unsafe", "error", "safe", "becomes_unsafe"]) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Assert that the oversized condition retains a readable preview
The size and omission-count assertions would still pass if every oversized label rendered as an empty string. In the
extra == 1case, also assert that the output contains a prefix of the multibyte label followed by the truncation marker. This directly covers the preview users see.