Skip to content

Commit

Permalink
Fix for flaky RPC/IPC test (#1077)
Browse files Browse the repository at this point in the history
* Ensure startipctest has finished before sendipcmessage
  • Loading branch information
swbsi authored Mar 30, 2021
1 parent 3e255d0 commit c31e390
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion full-stack-tests/rpc/src/backend/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { BackendTestCallbacks } from "../common/SideChannels";

export async function setupIpcTest(before = async () => { }) {
let socket: IpcWebSocketBackend;
let ready: () => void;
const started = new Promise<void>((resolve) => ready = resolve);

registerBackendCallback(BackendTestCallbacks.startIpcTest, () => {
setTimeout(async () => {
Expand All @@ -23,12 +25,15 @@ export async function setupIpcTest(before = async () => { }) {
socket.handle("testinvoke", async (_event: Event, methodName: string, ...args: any[]) => {
return [methodName, ...args];
});

ready();
});

return true;
});

registerBackendCallback(BackendTestCallbacks.sendIpcMessage, () => {
registerBackendCallback(BackendTestCallbacks.sendIpcMessage, async () => {
await started;
socket.send("test", 4, 5, 6);
return true;
});
Expand Down

0 comments on commit c31e390

Please sign in to comment.