The all-source query asserted an early healthy-log event survived an unfiltered --tail 100 while the intentionally broken service kept crash-looping and appending records, so the check raced the flood. Filter with --grep before the tail so eviction of unrelated events cannot fail the assertion. Both service log assertions also relied on jq -e select() over a multi-record JSONL stream, whose exit status tracks the final record rather than whether any record matched. Slurp and assert any() instead.
Showing the changes to tests (1 of 1 file). Show all
Unified · Split
| @@ -473,17 +473,21 @@ after_early="$(wc -l <"$events/broken.starts" | tr -d ' ')" · 472 unmodified lines | ||
| 473 | 473 | wait_for_count $((before + 1)) "$events/broken.starts" |
| 474 | 474 | [[ "$(wc -l <"$events/healthy.starts" | tr -d ' ')" == 1 ]] |
| 475 | 475 | |
| 476 | −# Each custom source is independently queryable, and `all` includes it. | |
| 476 | +# Each custom source is independently queryable, and `all` includes it. The | |
| 477 | +# crash-looping broken service floods the shared stream, so the all-source | |
| 478 | +# check filters before the tail; an unfiltered tail legitimately evicts old | |
| 479 | +# events. Assertions aggregate the stream: a matching record must exist even | |
| 480 | +# when later records differ. | |
| 477 | 481 | wait_for_pattern healthy-log "$logs/service-healthy.jsonl" |
| 478 | 482 | "$PROJECT_ROOT/guest/tx9-logs" query --agent-root "$data" \ |
| 479 | 483 | --executor-root "$tmp/empty-executor" --box fixture --source service-healthy \ |
| 480 | 484 | --tail 100 --json >"$tmp/service-query.jsonl" |
| 481 | −jq -e 'select(.source == "service-healthy" and .message == "healthy-log")' \ | |
| 485 | +jq -se 'any(.[]; .source == "service-healthy" and .message == "healthy-log")' \ | |
| 482 | 486 | "$tmp/service-query.jsonl" >/dev/null |
| 483 | 487 | "$PROJECT_ROOT/guest/tx9-logs" query --agent-root "$data" \ |
| 484 | 488 | --executor-root "$tmp/empty-executor" --box fixture --source all \ |
| 485 | − --tail 100 --json >"$tmp/all-query.jsonl" | |
| 486 | −jq -e 'select(.source == "service-healthy" and .message == "healthy-log")' \ | |
| 489 | + --grep healthy-log --tail 100 --json >"$tmp/all-query.jsonl" | |
| 490 | +jq -se 'any(.[]; .source == "service-healthy" and .message == "healthy-log")' \ | |
| 487 | 491 | "$tmp/all-query.jsonl" >/dev/null |
| 488 | 492 | |
| 489 | 493 | # Removing execute permission removes the desired service and synchronously |