KAFKA-18574 Sort test tables in JUnit summary by class and test name (#23945)

The test tables in the JUnit job summary (Failed, Flaky, Skipped,
Quarantined and New) are printed in the order the reports are parsed,
which follows the filesystem order of `glob()` and is not stable across
environments. This sorts each table by class name and test name before
rendering.

This is a continuation of #21786, which was closed as stale.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>

---------

Co-authored-by: Zhekai Chen <wrmxs227@gmail.com>
This commit is contained in:
ryanwahaandZhekai Chen authored and GitHub committed 2026-10-25 21:09:54 +08:00
1 parent 887ce0199f
commit 193acb15db
1 file changed
+6
+6
View File
@@ -384,6 +384,7 @@ if __name__ == "__main__":
print(f"| Module | Test | Message | Time |")
print(f"| ------ | ---- | ------- | ---- |")
logger.info(f"Found {len(failed_table)} test failures:")
failed_table.sort()
for row in failed_table:
logger.info(f"{FAILED} {row[0]} > {row[1]}")
row_joined = " | ".join(row)
@@ -398,6 +399,7 @@ if __name__ == "__main__":
print(f"| Module | Test | Message | Time |")
print(f"| ------ | ---- | ------- | ---- |")
logger.info(f"Found {len(flaky_table)} flaky test failures:")
flaky_table.sort()
for row in flaky_table:
logger.info(f"{FLAKY} {row[0]} > {row[1]}")
row_joined = " | ".join(row)
@@ -412,6 +414,7 @@ if __name__ == "__main__":
print(f"| Module | Test |")
print(f"| ------ | ---- |")
logger.debug(f"::group::Found {len(skipped_table)} skipped tests")
skipped_table.sort()
for row in skipped_table:
row_joined = " | ".join(row)
print(f"| {row_joined} |")
@@ -427,6 +430,7 @@ if __name__ == "__main__":
print(f"| Module | Test |")
print(f"| ------ | ---- |")
logger.debug(f"::group::Found {len(quarantined_table)} quarantined tests")
quarantined_table.sort()
for row in quarantined_table:
row_joined = " | ".join(row)
print(f"| {row_joined} |")
@@ -434,12 +438,14 @@ if __name__ == "__main__":
print("\n</details>")
logger.debug("::endgroup::")
# New
if len(new_table) > 0:
print("<details>")
print(f"<summary>New Tests ({len(new_table)})</summary>\n")
print(f"| Module | Test |")
print(f"| ------ | ---- |")
logger.debug(f"::group::Found {len(new_table)} new tests")
new_table.sort()
for row in new_table:
row_joined = " | ".join(row)
print(f"| {row_joined} |")