fix(chord): channel test attaches its expectation before the deadline can pass

This commit is contained in:
Mario Zechner 2026-11-03 07:29:13 +00:00
parent 5bd014b1c7
commit 0c7c741988

View file

@ -95,10 +95,13 @@ forEachCodec(() =>
const [a, b] = memoryLinkPair();
client.connect(a, { principal: { kind: "server" }, codec: testCodec() }, context);
const peer = new RawPeer(b, { hello: false });
const got = client.get(Thing, {}, context, { readyTimeout: 20 });
// The expectation is attached at once: on a slow machine the 20 ms pass before `flushed` returns.
const failed = expect(client.get(Thing, {}, context, { readyTimeout: 20 })).rejects.toThrow(
"app.thing: did not become live within 20 ms",
);
await flushed();
expect(peer.kinds()).toEqual(["hello"]);
await expect(got).rejects.toThrow("app.thing: did not become live within 20 ms");
await failed;
peer.send({ kind: "hello", protocol: PROTOCOL_VERSION, incarnation: RAW_PEER, calls: 256 });
await transported();
expect(peer.kinds()).toEqual(["hello", "hold", "release"]);