diff --git a/test/e2e/common/server.test.ts b/test/e2e/common/server.test.ts index ae87ba7b..9dd42a95 100644 --- a/test/e2e/common/server.test.ts +++ b/test/e2e/common/server.test.ts @@ -12,7 +12,8 @@ limitations under the License. */ import { CommunicationProtocolEnum, DaprServer, DaprPubSubStatusEnum } from "../../../src"; -//import * as NodeJSUtil from "../../../src/utils/NodeJS.util"; +import { sleep } from "../../../src/utils/NodeJS.util"; +import * as NodeJSUtil from "../../../src/utils/NodeJS.util"; const serverHost = "127.0.0.1"; const serverGrpcPort = "50001"; @@ -138,9 +139,10 @@ describe("common/server", () => { }); await setupPubSubSubscriptions(); - + await NodeJSUtil.sleep(2000) await httpServer.start(); await grpcServer.start(); + await NodeJSUtil.sleep(2000) }); beforeEach(() => { @@ -165,7 +167,7 @@ describe("common/server", () => { const res = await server.client.pubsub.publish(pubSubName, getTopic(topicWithStatusCb, protocol), "SUCCESS"); expect(res.error).toBeUndefined(); // Delay a bit for event to arrive - await new Promise((resolve, _reject) => setTimeout(resolve, 5000)); + await new Promise((resolve, _reject) => setTimeout(resolve, 2000)); expect(mockSubscribeStatusHandler.mock.calls.length).toBe(1); expect(mockSubscribeStatusHandler.mock.calls[0][1]).toEqual("SUCCESS"); expect(mockSubscribeDeadletterHandler.mock.calls.length).toBe(0);