The standing test's runs last 0.6 of failingAfterMs of clock as well as two attempts, so a success that does not reset a run is caught; the addition test holds a thousand stable passes, so 'first pass' is proved (review of the standing test races)
This commit is contained in:
@@ -134,14 +134,14 @@ test("a consumer failed for minutes is announced, naming it, its machine and the
|
||||
test("one success between failures starts the run again", async () => {
|
||||
const w = await world();
|
||||
try {
|
||||
// Each failing run lasts two failed attempts, counted, not a slept fraction of failingAfterMs. A run the load
|
||||
// Each failing run lasts two counted failed attempts and at least 0.6 of failingAfterMs of clock (long enough that a success which did not reset the run would be announced at the second run). A run the load
|
||||
// stretched to failingAfterMs is a long run and may be announced, so only runs that stayed short are asserted.
|
||||
const run = async (values?: Record<string, unknown>): Promise<number> => {
|
||||
const start = Date.now();
|
||||
const base = w.attempts;
|
||||
w.failing = new Error("connection refused");
|
||||
await w.ask([{ as: "a", values }]);
|
||||
await until(() => w.attempts >= base + 2);
|
||||
await until(() => w.attempts >= base + 2 && Date.now() - start >= FAILING_AFTER * 0.6);
|
||||
w.failing = null;
|
||||
return Date.now() - start;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user