Skip to content

Commit 0430173

Browse files
committed
fix: tests with lowercase names too
1 parent 857411f commit 0430173

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

.github/actions/test-failure-detection/action.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,27 @@ runs:
119119
# Initialize JSON array for structured failures with signatures
120120
echo '[]' > "$signatures_file"
121121
122+
# Define common test validation filter to avoid duplication
123+
local test_failure_filter='select(.Action == "fail" and .Test != null and .Test != "" and .Test != "null" and (.Test | test("^Test[A-Za-z]")))'
124+
122125
# Fast single-pass JSON extraction for test failures (< 1s for 10K lines)
123126
# Filter JSON lines and parse in one pass - eliminates 2-minute hang
124127
# Note: Line numbers aren't available in Go test JSON output
125128
# IMPORTANT: Only detect actual test function failures, not package/suite completion events
126129
grep '^{' "$json_file" 2>/dev/null | \
127-
jq -r 'select(.Action == "fail" and .Test != null and .Test != "" and .Test != "null" and (.Test | test("^Test[A-Za-z]"))) |
130+
jq -r "$test_failure_filter"' |
128131
"--- FAIL: \(.Test) (\(.Package))"' \
129132
2>/dev/null > "$failures_file"
130133
131134
# Create structured test failure entries with unique signatures
132-
if grep '^{' "$json_file" 2>/dev/null | jq -r 'select(.Action == "fail" and .Test != null and .Test != "" and .Test != "null" and (.Test | test("^Test[A-Za-z]")))' 2>/dev/null | head -1 | grep -q .; then
135+
if grep '^{' "$json_file" 2>/dev/null | jq -r "$test_failure_filter" 2>/dev/null | head -1 | grep -q .; then
133136
echo "📝 Creating structured test failure entries with enhanced output..."
134137
135138
# First pass: Extract test failure basic info from Action == "fail" entries
136139
local temp_failures
137140
temp_failures=$(mktemp)
138141
grep '^{' "$json_file" 2>/dev/null | \
139-
jq -r 'select(.Action == "fail" and .Test != null and .Test != "" and .Test != "null" and (.Test | test("^Test[A-Za-z]"))) | {
142+
jq -r "$test_failure_filter"' | {
140143
type: "test",
141144
package: .Package,
142145
test: (if (.Test and .Test != null and .Test != "null") then .Test else "unknown" end),

.github/workflows/fortress-test-matrix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ jobs:
264264
# Count ONLY failed test events, not package/suite failures which are expected
265265
# Look for Action="fail" AND Package field AND Test field (indicating actual test failure)
266266
JSON_FAILURES=$(grep '^{' test-output.log 2>/dev/null | \
267-
jq -r 'select(.Action == "fail" and .Test != null and .Test != "" and (.Package // "") != "" and (.Test | test("^Test[A-Z]"))) | .Test' 2>/dev/null | wc -l | xargs || echo "0")
267+
jq -r 'select(.Action == "fail" and .Test != null and .Test != "" and (.Package // "") != "" and (.Test | test("^Test[A-Za-z]"))) | .Test' 2>/dev/null | wc -l | xargs || echo "0")
268268
269269
if [[ $JSON_FAILURES -gt 0 ]]; then
270270
echo "⚠️ Found $JSON_FAILURES actual failing test functions in JSON output"

0 commit comments

Comments
 (0)