From b2e74e3ee8e867c5c210631a9efa7c8aa74d3752 Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Fri, 22 Dec 2023 12:20:41 -0800 Subject: [PATCH] change the way to assert template content Signed-off-by: Jackie Han --- .../flowframework/rest/FlowFrameworkRestApiIT.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java index f58a5b2ce..6999d2779 100644 --- a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java +++ b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java @@ -24,9 +24,12 @@ 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; @@ -196,8 +199,16 @@ public void testCreateAndProvisionAgentFrameworkWorkflow() throws Exception { // Assert based on the agent-framework template List resourcesCreated = searchHitWorkflowState.resourcesCreated(); + Set expectedStepNames = new HashSet<>(); + expectedStepNames.add("root_agent"); + expectedStepNames.add("sub_agent"); + expectedStepNames.add("openAI_connector"); + expectedStepNames.add("gpt-3.5-model"); + expectedStepNames.add("deployed-gpt-3.5-model"); + Set stepNames = resourcesCreated.stream().map(ResourceCreated::workflowStepId).collect(Collectors.toSet()); + assertEquals(5, resourcesCreated.size()); - assertEquals("create_connector", resourcesCreated.get(0).workflowStepName()); + assertEquals(stepNames, expectedStepNames); assertNotNull(resourcesCreated.get(0).resourceId()); // Hit Deprovision API