diff --git a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java index e4e827569..f58a5b2ce 100644 --- a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java +++ b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java @@ -197,13 +197,17 @@ public void testCreateAndProvisionAgentFrameworkWorkflow() throws Exception { // Assert based on the agent-framework template List resourcesCreated = searchHitWorkflowState.resourcesCreated(); assertEquals(5, resourcesCreated.size()); - assertEquals("register_agent", resourcesCreated.get(0).workflowStepName()); + assertEquals("create_connector", resourcesCreated.get(0).workflowStepName()); assertNotNull(resourcesCreated.get(0).resourceId()); // Hit Deprovision API Response deprovisionResponse = deprovisionWorkflow(workflowId); assertEquals(RestStatus.OK, TestHelpers.restStatus(deprovisionResponse)); - getAndAssertWorkflowStatus(workflowId, State.NOT_STARTED, ProvisioningProgress.NOT_STARTED); + assertBusy( + () -> { getAndAssertWorkflowStatus(workflowId, State.NOT_STARTED, ProvisioningProgress.NOT_STARTED); }, + 30, + TimeUnit.SECONDS + ); // Hit Delete API Response deleteResponse = deleteWorkflow(workflowId); @@ -211,7 +215,7 @@ public void testCreateAndProvisionAgentFrameworkWorkflow() throws Exception { // Search this workflow id in global_context index to make sure it's deleted SearchResponse searchResponseAfterDeletion = searchWorkflows(query); - assertEquals(0, searchResponse.getHits().getTotalHits().value); + assertBusy(() -> assertEquals(0, searchResponseAfterDeletion.getHits().getTotalHits().value), 30, TimeUnit.SECONDS); } }