From e4cb03f9ec7fd652159b35cbe738e649a63dd153 Mon Sep 17 00:00:00 2001 From: MregXN <46479059+MregXN@users.noreply.github.com> Date: Tue, 21 Nov 2023 01:27:14 +0800 Subject: [PATCH] fix flaky integration test MethodInvokeIT (#959) * fix flaky it MethodInvokeIT Signed-off-by: MregXN * add debug print Signed-off-by: MregXN * add debug print Signed-off-by: MregXN * add more waiting time Signed-off-by: MregXN * wait before invoke Signed-off-by: MregXN * wait for health before invoke Signed-off-by: MregXN --------- Signed-off-by: MregXN Co-authored-by: Artur Souza --- .../java/io/dapr/it/methodinvoke/grpc/MethodInvokeIT.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdk-tests/src/test/java/io/dapr/it/methodinvoke/grpc/MethodInvokeIT.java b/sdk-tests/src/test/java/io/dapr/it/methodinvoke/grpc/MethodInvokeIT.java index b3437d565..4d01dc05c 100644 --- a/sdk-tests/src/test/java/io/dapr/it/methodinvoke/grpc/MethodInvokeIT.java +++ b/sdk-tests/src/test/java/io/dapr/it/methodinvoke/grpc/MethodInvokeIT.java @@ -41,13 +41,15 @@ public class MethodInvokeIT extends BaseIT { DaprApiProtocol.GRPC, // appProtocol 60000); daprRun.switchToGRPC(); - daprRun.waitForAppHealth(20000); + daprRun.waitForAppHealth(40000); } @Test public void testInvoke() throws Exception { try (DaprClient client = new DaprClientBuilder().build()) { client.waitForSidecar(10000).block(); + daprRun.waitForAppHealth(10000); + for (int i = 0; i < NUM_MESSAGES; i++) { String message = String.format("This is message #%d", i); @@ -95,6 +97,8 @@ public class MethodInvokeIT extends BaseIT { public void testInvokeTimeout() throws Exception { try (DaprClient client = new DaprClientBuilder().build()) { client.waitForSidecar(10000).block(); + daprRun.waitForAppHealth(10000); + long started = System.currentTimeMillis(); SleepRequest req = SleepRequest.newBuilder().setSeconds(1).build(); String message = assertThrows(IllegalStateException.class, () -> @@ -110,6 +114,8 @@ public class MethodInvokeIT extends BaseIT { public void testInvokeException() throws Exception { try (DaprClient client = new DaprClientBuilder().build()) { client.waitForSidecar(10000).block(); + daprRun.waitForAppHealth(10000); + SleepRequest req = SleepRequest.newBuilder().setSeconds(-9).build(); DaprException exception = assertThrows(DaprException.class, () -> client.invokeMethod(daprRun.getAppName(), "sleep", req.toByteArray(), HttpExtension.POST).block());