Skip to content

Commit 8159f3a

Browse files
committed
Strip logger timestamp prefix to fix e2e test
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
1 parent 227e73b commit 8159f3a

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

tests/e2e/validate-json.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,26 @@ LOG="/tmp/e2e-output.log"
66
python3 -c "
77
import json, sys
88
9-
# The JSON output is on stdout; the log may also contain stderr debug lines.
10-
# Find the first line that parses as valid JSON.
9+
# The JSON output may be prefixed with a logger timestamp (e.g. '2026-04-08 22:46:50,580: {...}').
10+
# Try parsing the full line first, then from the first '{' character.
1111
found = False
1212
with open('$LOG') as f:
1313
for line in f:
1414
line = line.strip()
15-
if not line:
16-
continue
17-
try:
18-
data = json.loads(line)
19-
if isinstance(data, dict):
20-
found = True
21-
print(f'PASS: Valid JSON output with {len(data)} top-level key(s)')
22-
break
23-
except json.JSONDecodeError:
15+
if not line or '{' not in line:
2416
continue
17+
# Try full line first, then from the first brace
18+
for candidate in (line, line[line.index('{'):]):
19+
try:
20+
data = json.loads(candidate)
21+
if isinstance(data, dict):
22+
found = True
23+
print(f'PASS: Valid JSON output with {len(data)} top-level key(s)')
24+
break
25+
except json.JSONDecodeError:
26+
continue
27+
if found:
28+
break
2529
2630
if not found:
2731
print('FAIL: No valid JSON object found in output')

0 commit comments

Comments
 (0)