Skip to main content

Module clock

Module clock 

Source
Expand description

The one test-only knob on amont’s own waits.

Some behaviour exists only after a wait: a quiet run names its log once a check has run for five seconds, amont land re-reads the remote after a pause, a tree gate gets amont.treeLintSlack after the commit’s checks. A test of that behaviour has to outlast the wait, and at full length those tests were most of the integration suite’s time.

In a test-hooks build (every cargo test build of the binary, and no cargo build) AMONT_TEST_CLOCK_SCALE, a factor in (0, 1], shortens each wait that goes through scaled; .cargo/config.toml pins it for the tests, and the fixtures scale their own sleeps by the same factor. In a shipped binary scaled is the identity and reads nothing. The budgets that kill a check (amont.timeout, amont.idleTimeout) are not scaled: tests/timing.rs proves them on the real clock.

Functions§

scaled
d, shortened by the test clock scale where one applies.