CI(autocomment): add the lfc state (#10121)

## Problem
Currently, the report does not contain the LFC state of the failed
tests.
## Summary of changes
Added the LFC state to the link to the allure report.

---------

Co-authored-by: Alexander Bayandin <alexander@neon.tech>
This commit is contained in:
a-masterov
2025-01-23 15:52:07 +01:00
committed by GitHub
parent 3702ec889f
commit b6c0f66619
3 changed files with 13 additions and 4 deletions

View File

@@ -84,6 +84,12 @@ const parseReportJson = async ({ reportJsonUrl, fetch }) => {
} else { } else {
arch = "unknown" arch = "unknown"
} }
let lfcState = ""
if (test.parameters.includes("'with-lfc'")) {
lfcState = "with-lfc"
} else {
lfcState = "without-lfc"
}
// Removing build type and PostgreSQL version from the test name to make it shorter // Removing build type and PostgreSQL version from the test name to make it shorter
const testName = test.name.replace(new RegExp(`${buildType}-pg${pgVersion}-?`), "").replace("[]", "") const testName = test.name.replace(new RegExp(`${buildType}-pg${pgVersion}-?`), "").replace("[]", "")
@@ -91,6 +97,7 @@ const parseReportJson = async ({ reportJsonUrl, fetch }) => {
test.pgVersion = pgVersion test.pgVersion = pgVersion
test.buildType = buildType test.buildType = buildType
test.arch = arch test.arch = arch
test.lfcState = lfcState
if (test.status === "passed") { if (test.status === "passed") {
passedTests[pgVersion][testName].push(test) passedTests[pgVersion][testName].push(test)
@@ -157,7 +164,7 @@ const reportSummary = async (params) => {
const links = [] const links = []
for (const test of tests) { for (const test of tests) {
const allureLink = `${reportUrl}#suites/${test.parentUid}/${test.uid}` const allureLink = `${reportUrl}#suites/${test.parentUid}/${test.uid}`
links.push(`[${test.buildType}-${test.arch}](${allureLink})`) links.push(`[${test.buildType}-${test.arch}-${test.lfcState}](${allureLink})`)
} }
summary += `- \`${testName}\`: ${links.join(", ")}\n` summary += `- \`${testName}\`: ${links.join(", ")}\n`
} }
@@ -188,7 +195,7 @@ const reportSummary = async (params) => {
const links = [] const links = []
for (const test of tests) { for (const test of tests) {
const allureLink = `${reportUrl}#suites/${test.parentUid}/${test.uid}/retries` const allureLink = `${reportUrl}#suites/${test.parentUid}/${test.uid}/retries`
links.push(`[${test.buildType}-${test.arch}](${allureLink})`) links.push(`[${test.buildType}-${test.arch}-${test.lfcState}](${allureLink})`)
} }
summary += `- \`${testName}\`: ${links.join(", ")}\n` summary += `- \`${testName}\`: ${links.join(", ")}\n`
} }

View File

@@ -134,7 +134,7 @@ def ingest_test_result(
if p["name"].startswith("__") if p["name"].startswith("__")
} }
arch = parameters.get("arch", "UNKNOWN").strip("'") arch = parameters.get("arch", "UNKNOWN").strip("'")
lfc = parameters.get("lfc", "False") == "True" lfc = parameters.get("lfc", "without-lfc").strip("'") == "with-lfc"
build_type, pg_version, unparametrized_name = parse_test_name(test["name"]) build_type, pg_version, unparametrized_name = parse_test_name(test["name"])
labels = {label["name"]: label["value"] for label in test["labels"]} labels = {label["name"]: label["value"] for label in test["labels"]}

View File

@@ -121,6 +121,8 @@ def pytest_runtest_makereport(*args, **kwargs):
}.get(os.uname().machine, "UNKNOWN") }.get(os.uname().machine, "UNKNOWN")
arch = os.getenv("RUNNER_ARCH", uname_m) arch = os.getenv("RUNNER_ARCH", uname_m)
allure.dynamic.parameter("__arch", arch) allure.dynamic.parameter("__arch", arch)
allure.dynamic.parameter("__lfc", os.getenv("USE_LFC") != "false") allure.dynamic.parameter(
"__lfc", "with-lfc" if os.getenv("USE_LFC") != "false" else "without-lfc"
)
yield yield