Test: tracer_reload path change assumes events are still streaming when the reload lands #464

Closed
opened 2026-11-18 23:32:24 +00:00 by jcoffey-dev · 1 comment
Owner

system::tracer_reload fails on main in its Log tracer path-change part. Found while testing #456 (PR #462), which ran the same test on main to compare.

What happens. tests/src/system/tracer_reload.rs starts a stream of 2000 events, sleeps 5 ms, then moves the tracer to a new path. The stream only yields for 1 ms every 50 events, so it finishes in a few tens of ms, and here all 2000 events reached the old file before the reload ran. Then wait_for(&new_file, "seq-01999-end") never sees the last event in the new file, and no event of the stream reached the new file can't hold.

So the test depends on the stream still running when the reload lands, and nothing makes sure of that. A fast machine (or a slow reload) breaks it. CI only compiles tests (--no-run), so CI doesn't catch it.

Fix. Keep emitting until the reload is seen, not for a fixed count: run the stream until a stop flag is set, set it once a marker emitted after assert_applied shows up in the new file, then check that each sequence number is in exactly one file and that both files got some. Keep the other parts (JSON format switch, tracer removal) as they are.

Done when

  • tracer_reload_tests passes on main, run several times in a row
  • The path-change part still proves no event is lost or written twice across the switch
`system::tracer_reload` fails on main in its Log tracer path-change part. Found while testing #456 (PR #462), which ran the same test on main to compare. **What happens.** `tests/src/system/tracer_reload.rs` starts a stream of 2000 events, sleeps 5 ms, then moves the tracer to a new path. The stream only yields for 1 ms every 50 events, so it finishes in a few tens of ms, and here all 2000 events reached the old file before the reload ran. Then `wait_for(&new_file, "seq-01999-end")` never sees the last event in the new file, and `no event of the stream reached the new file` can't hold. So the test depends on the stream still running when the reload lands, and nothing makes sure of that. A fast machine (or a slow reload) breaks it. CI only compiles tests (`--no-run`), so CI doesn't catch it. **Fix.** Keep emitting until the reload is seen, not for a fixed count: run the stream until a stop flag is set, set it once a marker emitted after `assert_applied` shows up in the new file, then check that each sequence number is in exactly one file and that both files got some. Keep the other parts (JSON format switch, tracer removal) as they are. **Done when** - `tracer_reload_tests` passes on main, run several times in a row - The path-change part still proves no event is lost or written twice across the switch
jcoffey-dev added the bug
priority
p3
labels 2026-11-18 23:32:24 +00:00
Author
Owner

Fixed in #465. The path-change stream now runs until the new file has some of it, rather than for a fixed 2000 events, and the move starts only once the old file has some. The test still checks every event lands in exactly one file and both files get part of the stream. 6 of 6 local runs in a row passed (about 3,800 events each). Test-only, so nothing ships.

Fixed in #465. The path-change stream now runs until the new file has some of it, rather than for a fixed 2000 events, and the move starts only once the old file has some. The test still checks every event lands in exactly one file and both files get part of the stream. 6 of 6 local runs in a row passed (about 3,800 events each). Test-only, so nothing ships.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: inbuxa/inbuxa-server#464