From 3d595f86ab07daf81690a9bce3369167577b0cdf Mon Sep 17 00:00:00 2001 From: MregXN Date: Fri, 17 Nov 2023 22:07:09 +0800 Subject: [PATCH 1/6] fix flaky it MethodInvokeIT Signed-off-by: MregXN --- .../test/java/io/dapr/it/methodinvoke/grpc/MethodInvokeIT.java | 2 +- 1 file changed, 1 insertion(+), 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 b3437d565b..fad41b8e55 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,7 +41,7 @@ public void init() throws Exception { DaprApiProtocol.GRPC, // appProtocol 60000); daprRun.switchToGRPC(); - daprRun.waitForAppHealth(20000); + daprRun.waitForAppHealth(30000); } @Test From 7eba50d92128502daf08f081e2fb86a6be53b891 Mon Sep 17 00:00:00 2001 From: MregXN Date: Mon, 20 Nov 2023 10:31:38 +0800 Subject: [PATCH 2/6] add debug print Signed-off-by: MregXN --- .../java/io/dapr/it/methodinvoke/grpc/MethodInvokeIT.java | 4 ++++ 1 file changed, 4 insertions(+) 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 fad41b8e55..fd6b1d588f 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 @@ -40,14 +40,18 @@ public void init() throws Exception { MethodInvokeService.class, DaprApiProtocol.GRPC, // appProtocol 60000); + System.out.println("#### startDaprApp "); daprRun.switchToGRPC(); + System.out.println("#### switchToGRPC "); daprRun.waitForAppHealth(30000); + System.out.println("#### waitForAppHealth "); } @Test public void testInvoke() throws Exception { try (DaprClient client = new DaprClientBuilder().build()) { client.waitForSidecar(10000).block(); + System.out.println("#### waitForSidecar "); for (int i = 0; i < NUM_MESSAGES; i++) { String message = String.format("This is message #%d", i); From 9d7532ec76d1b5b354831cfabf42940b019a839a Mon Sep 17 00:00:00 2001 From: MregXN Date: Mon, 20 Nov 2023 11:09:49 +0800 Subject: [PATCH 3/6] add debug print Signed-off-by: MregXN --- .../test/java/io/dapr/it/methodinvoke/grpc/MethodInvokeIT.java | 2 ++ 1 file changed, 2 insertions(+) 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 fd6b1d588f..ffcb691096 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 @@ -122,6 +122,8 @@ public void testInvokeException() throws Exception { // This message is not ideal but last time it was improved, there was side effects reported by users. // If this test fails, there might be a regression in runtime (like we had in 1.10.0). // The expectations below are as per 1.9 release and (later on) hotfixed in 1.10. + System.out.println("#### "+exception.getErrorCode()); + System.out.println("#### "+exception.getMessage()); assertEquals("UNKNOWN", exception.getErrorCode()); assertEquals("UNKNOWN: ", exception.getMessage()); } From 87fea318e1745c1e10020c6f0762ef20f1e083dd Mon Sep 17 00:00:00 2001 From: MregXN Date: Mon, 20 Nov 2023 11:10:36 +0800 Subject: [PATCH 4/6] add more waiting time Signed-off-by: MregXN --- .../test/java/io/dapr/it/methodinvoke/grpc/MethodInvokeIT.java | 2 +- 1 file changed, 1 insertion(+), 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 ffcb691096..bc743d8c90 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 @@ -43,7 +43,7 @@ public void init() throws Exception { System.out.println("#### startDaprApp "); daprRun.switchToGRPC(); System.out.println("#### switchToGRPC "); - daprRun.waitForAppHealth(30000); + daprRun.waitForAppHealth(50000); System.out.println("#### waitForAppHealth "); } From 79f181c7d6cac103f2ac5e64aeaba8c98bf3c9e6 Mon Sep 17 00:00:00 2001 From: MregXN Date: Mon, 20 Nov 2023 13:25:41 +0800 Subject: [PATCH 5/6] wait before invoke Signed-off-by: MregXN --- .../java/io/dapr/it/methodinvoke/grpc/MethodInvokeIT.java | 4 +++- 1 file changed, 3 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 bc743d8c90..bf2b4e77b4 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 @@ -43,7 +43,7 @@ public void init() throws Exception { System.out.println("#### startDaprApp "); daprRun.switchToGRPC(); System.out.println("#### switchToGRPC "); - daprRun.waitForAppHealth(50000); + daprRun.waitForAppHealth(40000); System.out.println("#### waitForAppHealth "); } @@ -114,6 +114,8 @@ public void testInvokeTimeout() throws Exception { 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()); From 3cb5c9de97224ee1216f3ef250ca811446cfcd74 Mon Sep 17 00:00:00 2001 From: MregXN Date: Mon, 20 Nov 2023 14:14:32 +0800 Subject: [PATCH 6/6] wait for health before invoke Signed-off-by: MregXN --- .../io/dapr/it/methodinvoke/grpc/MethodInvokeIT.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 bf2b4e77b4..4d01dc05c6 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 @@ -40,18 +40,16 @@ public void init() throws Exception { MethodInvokeService.class, DaprApiProtocol.GRPC, // appProtocol 60000); - System.out.println("#### startDaprApp "); daprRun.switchToGRPC(); - System.out.println("#### switchToGRPC "); daprRun.waitForAppHealth(40000); - System.out.println("#### waitForAppHealth "); } @Test public void testInvoke() throws Exception { try (DaprClient client = new DaprClientBuilder().build()) { client.waitForSidecar(10000).block(); - System.out.println("#### waitForSidecar "); + daprRun.waitForAppHealth(10000); + for (int i = 0; i < NUM_MESSAGES; i++) { String message = String.format("This is message #%d", i); @@ -99,6 +97,8 @@ public void testInvoke() throws Exception { 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, () -> @@ -124,8 +124,6 @@ public void testInvokeException() throws Exception { // This message is not ideal but last time it was improved, there was side effects reported by users. // If this test fails, there might be a regression in runtime (like we had in 1.10.0). // The expectations below are as per 1.9 release and (later on) hotfixed in 1.10. - System.out.println("#### "+exception.getErrorCode()); - System.out.println("#### "+exception.getMessage()); assertEquals("UNKNOWN", exception.getErrorCode()); assertEquals("UNKNOWN: ", exception.getMessage()); }