mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-29 17:55:45 +01:00
LiveConfig takes the clock and the sleep its launch wait uses (Instant::now and std::thread::sleep unless a test changes them), and a hook that each resolve calls once it has noted how many starts have finished, before it waits for the lookup. All three are hidden from the docs. The four launch tests in tests/agents.rs no longer depend on how fast the machine runs: - A launch that never finishes advances the test clock by each poll, and the test checks that the wait polled until the 40 ms timeout passed. - Concurrent calls: the app accepts agents only after all four calls have queued and the start has begun, instead of 60 ms after the start. - Calls behind a failed start: the start returns once all four calls have queued, instead of after a 5 s poll and a 250 ms sleep, and the 150 ms timeout passes on the test clock. - A huge timeout or poll: the test records each sleep, checks that the poll is cut to 1 s, and checks that an app that never accepts agents gives up after 600 polls with "within 600 s", instead of checking that the call took less than 5 s. The file's wait_for helper, which polled for up to 5 s, has no caller left and is removed.