@@ -1491,12 +1491,69 @@ jobs:
14911491 echo "🚨 Failed Tests:"
14921492 echo "---------------"
14931493
1494- # Show detailed failed tests with package context
1495- # Show detailed failed tests with package context
1496- FAILED_TESTS=$(jq -r '.[] as $parent | $parent.failures[] | .Test + " (" + ($parent.Package | split("/") | .[-1] // .[-2] // .) + ")"' "$failure_file" 2>/dev/null | head -20)
1494+ # Show detailed failed tests with package context (leaf failures only)
1495+ #
1496+ # Problem: Go's nested test structure (TestA/TestB/TestC) reports failures for
1497+ # all parent tests when a leaf test fails, causing confusing output like:
1498+ # ❌ TestNetworkEdgeCases/concurrent_api_operations/concurrency_3 (integration) <- actual failure
1499+ # ❌ TestNetworkEdgeCases/concurrent_api_operations (integration) <- parent (redundant)
1500+ # ❌ TestNetworkEdgeCases (integration) <- parent (redundant)
1501+ # ❌ (integration) <- empty (artifact)
1502+ #
1503+ # Solution: Extract and deduplicate to show only the actual failed leaf tests
1504+ # This reduces "4 failures" to "1 actual failure" for better clarity.
1505+ RAW_FAILED_TESTS=$(jq -r '.[] as $parent | $parent.failures[] | .Test + " (" + ($parent.Package | split("/") | .[-1] // .[-2] // .) + ")"' "$failure_file" 2>/dev/null)
1506+
1507+ # Smart filtering: Only show the most specific (deepest nested) test failures
1508+ FAILED_TESTS=$(echo "$RAW_FAILED_TESTS" | awk '
1509+ {
1510+ # Skip empty lines
1511+ if ($0 == "" || $0 ~ /^[[:space:]]*$/) next
1512+
1513+ # Extract test name before package info
1514+ if (match($0, /^([^(]*[^[:space:]]) \(.*\)$/)) {
1515+ testname = substr($0, RSTART, RLENGTH)
1516+ gsub(/ \(.*\)$/, "", testname)
1517+ # Remove leading/trailing whitespace
1518+ gsub(/^[[:space:]]+|[[:space:]]+$/, "", testname)
1519+ # Skip if testname is empty
1520+ if (testname == "") next
1521+
1522+ # Count depth by number of "/" characters
1523+ depth_counter = testname
1524+ gsub(/[^\/]/, "", depth_counter)
1525+ depth = length(depth_counter)
1526+ tests[NR] = $0
1527+ depths[NR] = depth
1528+ names[NR] = testname
1529+ }
1530+ }
1531+ END {
1532+ # For each test, check if there is a more specific (deeper) version
1533+ for (i in tests) {
1534+ is_leaf = 1
1535+ for (j in tests) {
1536+ if (i != j && depths[j] > depths[i] && index(names[j], names[i]) == 1) {
1537+ is_leaf = 0
1538+ break
1539+ }
1540+ }
1541+ if (is_leaf && names[i] != "") print tests[i]
1542+ }
1543+ }
1544+ ' | head -20)
14971545
14981546 if [[ -n "$FAILED_TESTS" ]]; then
14991547 echo "$FAILED_TESTS" | sed 's/^/ ❌ /'
1548+
1549+ # Update failure count to reflect actual unique failures
1550+ ACTUAL_UNIQUE_FAILURES=$(echo "$FAILED_TESTS" | grep -v '^[[:space:]]*$' | wc -l)
1551+ RAW_FAILURE_COUNT=$(echo "$RAW_FAILED_TESTS" | grep -v '^[[:space:]]*$' | wc -l)
1552+ if [[ $RAW_FAILURE_COUNT -gt $ACTUAL_UNIQUE_FAILURES ]]; then
1553+ echo ""
1554+ echo " 📊 Note: Showing $ACTUAL_UNIQUE_FAILURES actual failures"
1555+ echo " (filtered from $RAW_FAILURE_COUNT nested test hierarchy entries)"
1556+ fi
15001557 else
15011558 echo " ⚠️ No test failures found in JSON structure"
15021559 echo " 📄 Raw JSON content:"
0 commit comments