mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(chord): channel test attaches its expectation before the deadline can pass
This commit is contained in:
parent
5bd014b1c7
commit
0c7c741988
1 changed files with 5 additions and 2 deletions
|
|
@ -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"]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue