Merge pull request #49151 from ClickHouse/improve-test-reports

Improve test reports
This commit is contained in:
Mikhail f. Shiryaev 2023-04-26 12:19:50 +02:00 committed by GitHub
commit 464a3961d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 9 deletions

View File

@ -142,6 +142,7 @@ if __name__ == "__main__":
.replace("(", "_")
.replace(")", "_")
.replace(",", "_")
.replace("/", "_")
)
docker_image = get_image_with_version(reports_path, IMAGE_NAME)

View File

@ -262,17 +262,20 @@ class ReportColorTheme:
ColorTheme = Tuple[str, str, str]
def _format_header(header, branch_name, branch_url=None):
result = " ".join([w.capitalize() for w in header.split(" ")])
def _format_header(
header: str, branch_name: str, branch_url: Optional[str] = None
) -> str:
# Following line does not lower CI->Ci and SQLancer->Sqlancer. It only
# capitalizes the first letter and doesn't touch the rest of the word
result = " ".join([w[0].upper() + w[1:] for w in header.split(" ") if w])
result = result.replace("Clickhouse", "ClickHouse")
result = result.replace("clickhouse", "ClickHouse")
if "ClickHouse" not in result:
result = "ClickHouse " + result
result += " for "
result = f"ClickHouse {result}"
if branch_url:
result += f'<a href="{branch_url}">{branch_name}</a>'
result = f'{result} for <a href="{branch_url}">{branch_name}</a>'
else:
result += branch_name
result = f"{result} for {branch_name}"
return result

View File

@ -59,9 +59,10 @@ def upload_results(
additional_files: List[str],
check_name: str,
) -> str:
s3_path_prefix = f"{pr_number}/{commit_sha}/" + check_name.lower().replace(
" ", "_"
).replace("(", "_").replace(")", "_").replace(",", "_")
normalized_check_name = check_name.lower()
for r in ((" ", "_"), ("(", "_"), (")", "_"), (",", "_"), ("/", "_")):
normalized_check_name = normalized_check_name.replace(*r)
s3_path_prefix = f"{pr_number}/{commit_sha}/{normalized_check_name}"
additional_urls = process_logs(
s3_client, additional_files, s3_path_prefix, test_results
)