fix flaky integration test MethodInvokeIT (#959)

* fix flaky it MethodInvokeIT

Signed-off-by: MregXN <mregxn@gmail.com>

* add debug print

Signed-off-by: MregXN <mregxn@gmail.com>

* add debug print

Signed-off-by: MregXN <mregxn@gmail.com>

* add more waiting time

Signed-off-by: MregXN <mregxn@gmail.com>

* wait before invoke

Signed-off-by: MregXN <mregxn@gmail.com>

* wait for health before invoke

Signed-off-by: MregXN <mregxn@gmail.com>

---------

Signed-off-by: MregXN <mregxn@gmail.com>
Co-authored-by: Artur Souza <artursouza.ms@outlook.com>
This commit is contained in:
MregXN 2023-11-21 01:27:14 +08:00 committed by GitHub
parent 5c79585e29
commit e4cb03f9ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -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());