diff --git a/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/test/java/org/kie/kogito/examples/DataIndexRestIT.java b/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/test/java/org/kie/kogito/examples/DataIndexRestIT.java index e20124127d..b09be166f9 100644 --- a/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/test/java/org/kie/kogito/examples/DataIndexRestIT.java +++ b/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/test/java/org/kie/kogito/examples/DataIndexRestIT.java @@ -61,11 +61,15 @@ void testDataIndexRest() { .then() .statusCode(404)); - given().contentType(ContentType.JSON).body("{ \"query\" : \"{ ProcessInstances(where: { id: {equal: \\\"" + processInstanceId + "\\\"}}) { id, state } }\" }") - .when().post("/graphql") - .then().statusCode(200) - .body("data.ProcessInstances.size()", is(1)) - .body("data.ProcessInstances[0].id", is(processInstanceId)) - .body("data.ProcessInstances[0].state", is("COMPLETED")); + await() + .atLeast(1, SECONDS) + .atMost(30, SECONDS) + .with().pollInterval(1, SECONDS) + .untilAsserted(() -> given().contentType(ContentType.JSON).body("{ \"query\" : \"{ ProcessInstances(where: { id: {equal: \\\"" + processInstanceId + "\\\"}}) { id, state } }\" }") + .when().post("/graphql") + .then().statusCode(200) + .body("data.ProcessInstances.size()", is(1)) + .body("data.ProcessInstances[0].id", is(processInstanceId)) + .body("data.ProcessInstances[0].state", is("COMPLETED"))); } }