Skip to content

Commit

Permalink
fix flaky integration test MethodInvokeIT (#959)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
MregXN and artursouza authored Nov 20, 2023
1 parent 5c79585 commit e4cb03f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ public void init() throws Exception {
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);

Expand Down Expand Up @@ -95,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, () ->
Expand All @@ -110,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());
Expand Down

0 comments on commit e4cb03f

Please sign in to comment.