diff --git a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java index 8fa2fa43d..680ab7193 100644 --- a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java +++ b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java @@ -8,6 +8,18 @@ */ package org.opensearch.flowframework.rest; +import static org.opensearch.flowframework.common.CommonValue.CREDENTIAL_FIELD; +import static org.opensearch.flowframework.common.CommonValue.PROVISION_WORKFLOW; +import static org.opensearch.flowframework.common.CommonValue.WORKFLOW_ID; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + import org.opensearch.action.search.SearchResponse; import org.opensearch.client.Response; import org.opensearch.client.ResponseException; @@ -23,18 +35,6 @@ import org.opensearch.flowframework.model.WorkflowNode; import org.opensearch.flowframework.model.WorkflowState; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import static org.opensearch.flowframework.common.CommonValue.CREDENTIAL_FIELD; -import static org.opensearch.flowframework.common.CommonValue.PROVISION_WORKFLOW; -import static org.opensearch.flowframework.common.CommonValue.WORKFLOW_ID; - public class FlowFrameworkRestApiIT extends FlowFrameworkRestTestCase { public void testSearchWorkflows() throws Exception { @@ -140,7 +140,7 @@ public void testCreateAndProvisionRemoteModelWorkflow() throws Exception { Workflow cyclicalWorkflow = new Workflow( originalWorkflow.userParams(), originalWorkflow.nodes(), - List.of(new WorkflowEdge("workflow_step_1", "workflow_step_2"), new WorkflowEdge("workflow_step_2", "workflow_step_1")) + List.of(new WorkflowEdge("workflow_step_2", "workflow_step_3"), new WorkflowEdge("workflow_step_3", "workflow_step_2")) ); Template cyclicalTemplate = new Template.Builder().name(template.name()) @@ -155,7 +155,10 @@ public void testCreateAndProvisionRemoteModelWorkflow() throws Exception { // Hit dry run ResponseException exception = expectThrows(ResponseException.class, () -> createWorkflowValidation(cyclicalTemplate)); - assertTrue(exception.getMessage().contains("Cycle detected: [workflow_step_2->workflow_step_1, workflow_step_1->workflow_step_2]")); + // output order not guaranteed + assertTrue(exception.getMessage().contains("Cycle detected")); + assertTrue(exception.getMessage().contains("workflow_step_2->workflow_step_3")); + assertTrue(exception.getMessage().contains("workflow_step_3->workflow_step_2")); // Hit Create Workflow API with original template Response response = createWorkflow(template);