Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def _git_log_merge_prs(
if not m:
continue
pr_number, head_owner = int(m.group(1)), m.group(2)
if head_owner.lower() != repo.split("/")[0].lower():
if head_owner == 'ClickHouse':
continue
rows.append(
{
Expand Down Expand Up @@ -362,8 +362,8 @@ def get_prs_in_release_dataframe(
f"""
PRs merged into branch_ref that belong in the next release notes: after the latest GitHub
Release tag on this history, or after the oldest rebase bootstrap if no such tag exists.
Only merge commits whose subject has from <repo_owner>/ (e.g. from Altinity/) are included.
Columns: pr_number, pr_name, labels. Omits PRs labeled cicd.
Merge commits whose subject is from the upstream repository (ClickHouse/) are omitted.
Columns: pr_number, pr_name, labels.

Returns (dataframe, baseline_date YYYY-MM-DD or None).
"""
Expand Down
26 changes: 25 additions & 1 deletion .github/actions/create_workflow_report/test_report_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
"""

import os
import subprocess
from unittest.mock import patch

import pandas as pd
from clickhouse_driver import Client
from testflows.core import *

from create_workflow_report import get_checks_fails
from create_workflow_report import _git_log_merge_prs, get_checks_fails


def check_result_matches_expect(df: pd.DataFrame, expect: list[str]) -> None:
Expand Down Expand Up @@ -149,10 +151,32 @@ def test_checks_fails_query(self, case_id, commit_sha, head_ref, expect):
check_result_matches_expect(df, list(expect))


@TestScenario
def test_git_log_merge_prs_includes_fork_prs(self):
"""Test PR merge history includes contributor forks."""
stdout = "\n".join(
[
f"{'e' * 40}\tMerge pull request #2226 from strtgbb/community-pr-failure-artifacts",
f"{'a' * 40}\tMerge pull request #113355 from ClickHouse/backport/26.6/112784",
f"{'b' * 40}\tMerge pull request #2252 from Altinity/ci/antalya-26.6/container-dns",
]
)
with When("I collect fork, upstream, and Altinity pull request merges"):
with patch(
"create_workflow_report.subprocess.run",
return_value=subprocess.CompletedProcess([], 0, stdout=stdout),
):
df = _git_log_merge_prs("baseline", "branch", None, "Altinity/ClickHouse")

with Then("fork and Altinity pull requests are included but upstream is omitted"):
assert set(df["pr_number"]) == {2226, 2252}


@Name("test report queries")
@TestModule
def test_report_queries(self):
Scenario(run=test_checks_fails_query, flags=TE)
Scenario(run=test_git_log_merge_prs_includes_fork_prs, flags=TE)


if main():
Expand Down
Loading