diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b903ff6..58e89fb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) ### Enhancements ### Bug Fixes +- Change REST status codes for RBAC and provisioning ([#1083](https://github.com/opensearch-project/flow-framework/pull/1083)) + ### Infrastructure ### Documentation ### Maintenance diff --git a/src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java b/src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java index e91678d5..d2569887 100644 --- a/src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java +++ b/src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java @@ -253,7 +253,7 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli return channel -> client.execute(CreateWorkflowAction.INSTANCE, workflowRequest, ActionListener.wrap(response -> { XContentBuilder builder = response.toXContent(channel.newBuilder(), ToXContent.EMPTY_PARAMS); - channel.sendResponse(new BytesRestResponse(RestStatus.CREATED, builder)); + channel.sendResponse(new BytesRestResponse(provision || reprovision ? RestStatus.ACCEPTED : RestStatus.CREATED, builder)); }, exception -> { try { FlowFrameworkException ex = exception instanceof FlowFrameworkException diff --git a/src/main/java/org/opensearch/flowframework/rest/RestProvisionWorkflowAction.java b/src/main/java/org/opensearch/flowframework/rest/RestProvisionWorkflowAction.java index bb853224..a51da7ae 100644 --- a/src/main/java/org/opensearch/flowframework/rest/RestProvisionWorkflowAction.java +++ b/src/main/java/org/opensearch/flowframework/rest/RestProvisionWorkflowAction.java @@ -100,7 +100,7 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli ); return channel -> client.execute(ProvisionWorkflowAction.INSTANCE, workflowRequest, ActionListener.wrap(response -> { XContentBuilder builder = response.toXContent(channel.newBuilder(), ToXContent.EMPTY_PARAMS); - channel.sendResponse(new BytesRestResponse(RestStatus.OK, builder)); + channel.sendResponse(new BytesRestResponse(RestStatus.ACCEPTED, builder)); }, exception -> { try { FlowFrameworkException ex = exception instanceof FlowFrameworkException diff --git a/src/main/java/org/opensearch/flowframework/util/ParseUtils.java b/src/main/java/org/opensearch/flowframework/util/ParseUtils.java index a0e94b94..6466ff35 100644 --- a/src/main/java/org/opensearch/flowframework/util/ParseUtils.java +++ b/src/main/java/org/opensearch/flowframework/util/ParseUtils.java @@ -509,10 +509,7 @@ public static void onGetWorkflowResponse( } else { logger.debug("User: " + requestUser.getName() + " does not have permissions to access workflow: " + workflowId); listener.onFailure( - new FlowFrameworkException( - "User does not have permissions to access workflow: " + workflowId, - RestStatus.BAD_REQUEST - ) + new FlowFrameworkException("User does not have permissions to access workflow: " + workflowId, RestStatus.FORBIDDEN) ); } } catch (Exception e) { diff --git a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java index 8beba892..0326b236 100644 --- a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java +++ b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java @@ -89,7 +89,7 @@ public void testFailedUpdateWorkflow() throws Exception { String workflowId = (String) responseMap.get(WORKFLOW_ID); Response provisionResponse = provisionWorkflow(client(), workflowId); - assertEquals(RestStatus.OK, TestHelpers.restStatus(provisionResponse)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(provisionResponse)); getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS); // Failed update since provisioning has started @@ -111,7 +111,7 @@ public void testUpdateWorkflowUsingFields() throws Exception { String workflowId = (String) responseMap.get(WORKFLOW_ID); Response provisionResponse = provisionWorkflow(client(), workflowId); - assertEquals(RestStatus.OK, TestHelpers.restStatus(provisionResponse)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(provisionResponse)); getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS); // Attempt to update with update_fields with illegal field @@ -179,7 +179,7 @@ public void testCreateAndProvisionLocalModelWorkflow() throws Exception { // Reattempt Provision response = provisionWorkflow(client(), workflowId); - assertEquals(RestStatus.OK, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS); // Wait until provisioning has completed successfully before attempting to retrieve created resources @@ -240,7 +240,7 @@ public void testCreateAndProvisionRemoteModelWorkflow() throws Exception { getAndAssertWorkflowStatus(client(), workflowId, State.NOT_STARTED, ProvisioningProgress.NOT_STARTED); response = provisionWorkflow(client(), workflowId); - assertEquals(RestStatus.OK, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS); // Wait until provisioning has completed successfully before attempting to retrieve created resources @@ -270,7 +270,7 @@ public void testCreateAndProvisionAgentFrameworkWorkflow() throws Exception { // Hit Create Workflow API to create agent-framework template, with template validation check and provision parameter Response response = createWorkflowWithProvision(client(), template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); Map responseMap = entityAsMap(response); String workflowId = (String) responseMap.get(WORKFLOW_ID); // wait and ensure state is completed/done @@ -345,7 +345,7 @@ public void testCreateAndProvisionConnectorToolAgentFrameworkWorkflow() throws E // Hit Create Workflow API to create agent-framework template, with template validation check and provision parameter Response response = createWorkflowWithProvision(client(), template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); Map responseMap = entityAsMap(response); String workflowId = (String) responseMap.get(WORKFLOW_ID); // wait and ensure state is completed/done @@ -417,7 +417,7 @@ public void testReprovisionWorkflow() throws Exception { Template template = TestHelpers.createTemplateFromFile("registerremotemodel.json"); Response response = createWorkflowWithProvision(client(), template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); Map responseMap = entityAsMap(response); String workflowId = (String) responseMap.get(WORKFLOW_ID); // wait and ensure state is completed/done @@ -438,7 +438,7 @@ public void testReprovisionWorkflow() throws Exception { // Reprovision template to add ingest pipeline which uses the model ID template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline.json"); response = reprovisionWorkflow(client(), workflowId, template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); resourcesCreated = getResourcesCreated(client(), workflowId, 30); assertEquals(4, resourcesCreated.size()); @@ -457,7 +457,7 @@ public void testReprovisionWorkflow() throws Exception { // Reprovision template to add index which uses default ingest pipeline template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json"); response = reprovisionWorkflow(client(), workflowId, template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); resourcesCreated = getResourcesCreated(client(), workflowId, 30); assertEquals(5, resourcesCreated.size()); @@ -475,7 +475,7 @@ public void testReprovisionWorkflow() throws Exception { // Reprovision template to remove default ingest pipeline template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-updateindex.json"); response = reprovisionWorkflow(client(), workflowId, template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); resourcesCreated = getResourcesCreated(client(), workflowId, 30); // resource count should remain unchanged when updating an existing node @@ -504,7 +504,7 @@ public void testReprovisionWorkflowMidNodeAddition() throws Exception { Template template = TestHelpers.createTemplateFromFile("registerremotemodel-createindex.json"); Response response = createWorkflowWithProvision(client(), template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); Map responseMap = entityAsMap(response); String workflowId = (String) responseMap.get(WORKFLOW_ID); // wait and ensure state is completed/done @@ -526,7 +526,7 @@ public void testReprovisionWorkflowMidNodeAddition() throws Exception { // Reprovision template to add ingest pipeline which uses the model ID template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json"); response = reprovisionWorkflow(client(), workflowId, template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); resourcesCreated = getResourcesCreated(client(), workflowId, 30); assertEquals(5, resourcesCreated.size()); @@ -565,7 +565,7 @@ public void testReprovisionWithNoChange() throws Exception { Template template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json"); Response response = createWorkflowWithProvision(client(), template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); Map responseMap = entityAsMap(response); String workflowId = (String) responseMap.get(WORKFLOW_ID); // wait and ensure state is completed/done @@ -602,7 +602,7 @@ public void testReprovisionWithDeletion() throws Exception { Template template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json"); Response response = createWorkflowWithProvision(client(), template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); Map responseMap = entityAsMap(response); String workflowId = (String) responseMap.get(WORKFLOW_ID); // wait and ensure state is completed/done @@ -670,7 +670,7 @@ public void testTimestamps() throws Exception { // Provision the template, should have created and updated same as before and provisioned newer response = provisionWorkflow(client(), workflowId); - assertEquals(RestStatus.OK.getStatus(), response.getStatusLine().getStatusCode()); + assertEquals(RestStatus.ACCEPTED.getStatus(), response.getStatusLine().getStatusCode()); response = getWorkflow(client(), workflowId); assertEquals(RestStatus.OK.getStatus(), response.getStatusLine().getStatusCode()); @@ -698,7 +698,7 @@ public void testCreateAndProvisionIngestAndSearchPipeline() throws Exception { getAndAssertWorkflowStatus(client(), workflowId, State.NOT_STARTED, ProvisioningProgress.NOT_STARTED); response = provisionWorkflow(client(), workflowId); - assertEquals(RestStatus.OK, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS); // Wait until provisioning has completed successfully before attempting to retrieve created resources @@ -744,7 +744,7 @@ public void testDefaultCohereUseCase() throws Exception { getAndAssertWorkflowStatus(client(), workflowId, State.NOT_STARTED, ProvisioningProgress.NOT_STARTED); response = provisionWorkflow(client(), workflowId); - assertEquals(RestStatus.OK, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS); // Wait until provisioning has completed successfully before attempting to retrieve created resources @@ -788,7 +788,7 @@ public void testDefaultSemanticSearchUseCaseWithFailureExpected() throws Excepti getAndAssertWorkflowStatus(client(), workflowId, State.NOT_STARTED, ProvisioningProgress.NOT_STARTED); response = provisionWorkflow(client(), workflowId); - assertEquals(RestStatus.OK, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); getAndAssertWorkflowStatus(client(), workflowId, State.FAILED, ProvisioningProgress.FAILED); } @@ -824,7 +824,7 @@ public void testSemanticSearchWithLocalModelEndToEnd() throws Exception { defaults.put("text_embedding.field_map.output.dimension", 384); Response response = createAndProvisionWorkflowWithUseCaseWithContent(client(), "semantic_search_with_local_model", defaults); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); Map responseMap = entityAsMap(response); String workflowId = (String) responseMap.get(WORKFLOW_ID); diff --git a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkSecureRestApiIT.java b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkSecureRestApiIT.java index f1fb6aaa..a6cae165 100644 --- a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkSecureRestApiIT.java +++ b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkSecureRestApiIT.java @@ -323,7 +323,7 @@ public void testProvisionWorkflowWithWriteAccess() throws Exception { Map responseMap = entityAsMap(aliceWorkflow); String workflowId = (String) responseMap.get(WORKFLOW_ID); Response response = provisionWorkflow(aliceClient, workflowId); - assertEquals(RestStatus.OK, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); } public void testReprovisionWorkflowWithWriteAccess() throws Exception { @@ -333,7 +333,7 @@ public void testReprovisionWorkflowWithWriteAccess() throws Exception { enableFilterBy(); Response response = createWorkflowWithProvision(aliceClient, template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); Map responseMap = entityAsMap(response); String workflowId = (String) responseMap.get(WORKFLOW_ID); @@ -356,7 +356,7 @@ public void testReprovisionWorkflowWithWriteAccess() throws Exception { // Reprovision template to add ingest pipeline which uses the model ID template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json"); response = reprovisionWorkflow(aliceClient, workflowId, template); - assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); resourcesCreated = getResourcesCreated(aliceClient, workflowId, 30); assertEquals(5, resourcesCreated.size()); @@ -426,7 +426,7 @@ public void testCreateProvisionDeprovisionWorkflowWithFullAccess() throws Except } else { response = provisionWorkflow(aliceClient, workflowId); } - assertEquals(RestStatus.OK, TestHelpers.restStatus(response)); + assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response)); // Invoke status API response = getWorkflowStatus(aliceClient, workflowId, false); diff --git a/src/test/java/org/opensearch/flowframework/rest/RestCreateWorkflowActionTests.java b/src/test/java/org/opensearch/flowframework/rest/RestCreateWorkflowActionTests.java index 3cff549f..3d0e299e 100644 --- a/src/test/java/org/opensearch/flowframework/rest/RestCreateWorkflowActionTests.java +++ b/src/test/java/org/opensearch/flowframework/rest/RestCreateWorkflowActionTests.java @@ -126,7 +126,7 @@ public void testCreateWorkflowRequestWithParamsAndProvision() throws Exception { return null; }).when(nodeClient).execute(any(), any(WorkflowRequest.class), any()); createWorkflowRestAction.handleRequest(request, channel, nodeClient); - assertEquals(RestStatus.CREATED, channel.capturedResponse().status()); + assertEquals(RestStatus.ACCEPTED, channel.capturedResponse().status()); assertTrue(channel.capturedResponse().content().utf8ToString().contains("id-123")); } @@ -146,7 +146,7 @@ public void testRestCreateWorkflowWithWaitForCompletionTimeout() throws Exceptio createWorkflowRestAction.handleRequest(request, channel, nodeClient); - assertEquals(RestStatus.CREATED, channel.capturedResponse().status()); + assertEquals(RestStatus.ACCEPTED, channel.capturedResponse().status()); assertTrue(channel.capturedResponse().content().utf8ToString().contains("workflow_1")); } diff --git a/src/test/java/org/opensearch/flowframework/rest/RestProvisionWorkflowActionTests.java b/src/test/java/org/opensearch/flowframework/rest/RestProvisionWorkflowActionTests.java index ed2816c4..7629056f 100644 --- a/src/test/java/org/opensearch/flowframework/rest/RestProvisionWorkflowActionTests.java +++ b/src/test/java/org/opensearch/flowframework/rest/RestProvisionWorkflowActionTests.java @@ -91,7 +91,7 @@ public void testContentParsing() throws Exception { return null; }).when(nodeClient).execute(any(), any(WorkflowRequest.class), any()); provisionWorkflowRestAction.handleRequest(request, channel, nodeClient); - assertEquals(RestStatus.OK, channel.capturedResponse().status()); + assertEquals(RestStatus.ACCEPTED, channel.capturedResponse().status()); assertTrue(channel.capturedResponse().content().utf8ToString().contains("id-123")); } @@ -162,7 +162,7 @@ public void testProvisionWorkflowWithValidWaitForCompletionTimeout() throws Exce provisionWorkflowRestAction.handleRequest(request, channel, nodeClient); - assertEquals(RestStatus.OK, channel.capturedResponse().status()); + assertEquals(RestStatus.ACCEPTED, channel.capturedResponse().status()); assertTrue(channel.capturedResponse().content().utf8ToString().contains("workflow_1")); } diff --git a/src/test/java/org/opensearch/flowframework/rest/RestWorkflowProvisionTenantAwareIT.java b/src/test/java/org/opensearch/flowframework/rest/RestWorkflowProvisionTenantAwareIT.java index 4db5f818..b52dbeb2 100644 --- a/src/test/java/org/opensearch/flowframework/rest/RestWorkflowProvisionTenantAwareIT.java +++ b/src/test/java/org/opensearch/flowframework/rest/RestWorkflowProvisionTenantAwareIT.java @@ -97,14 +97,14 @@ public void testWorkflowProvisionThrottle() throws Exception { */ // Kick off a provisioning response = makeRequest(tenantRequest, POST, WORKFLOW_PATH + workflowId1 + PROVISION); - assertOK(response); + assertOkOrAccepted(response); map = responseToMap(response); assertTrue(map.containsKey(WORKFLOW_ID)); assertEquals(workflowId1, map.get(WORKFLOW_ID).toString()); // During the 3 second async provisioning, try another one // Another workflow should be fine response = makeRequest(otherTenantRequest, POST, WORKFLOW_PATH + otherWorkflowId + PROVISION); - assertOK(response); + assertOkOrAccepted(response); map = responseToMap(response); assertTrue(map.containsKey(WORKFLOW_ID)); assertEquals(otherWorkflowId, map.get(WORKFLOW_ID).toString()); @@ -130,14 +130,14 @@ public void testWorkflowProvisionThrottle() throws Exception { // Provision should work now response = makeRequest(tenantRequest, POST, WORKFLOW_PATH + workflowId2 + PROVISION); - assertOK(response); + assertOkOrAccepted(response); map = responseToMap(response); assertTrue(map.containsKey(WORKFLOW_ID)); assertEquals(workflowId2, map.get(WORKFLOW_ID).toString()); } else { // No throttling at all without multitenancy response = makeRequest(tenantRequest, POST, WORKFLOW_PATH + workflowId2 + PROVISION); - assertOK(response); + assertOkOrAccepted(response); map = responseToMap(response); assertTrue(map.containsKey(WORKFLOW_ID)); assertEquals(workflowId2, map.get(WORKFLOW_ID).toString()); @@ -176,7 +176,7 @@ public void testWorkflowProvisionThrottle() throws Exception { // Reprovision a workflow with a tenant id RestRequest updateWorkflowRequest = getRestRequestWithHeadersAndContent(tenantId, createNoOpTemplateWithDelayNodes(2)); response = makeRequest(updateWorkflowRequest, PUT, WORKFLOW_PATH + workflowId1 + "?reprovision=true"); - assertOK(response); + assertOkOrAccepted(response); map = responseToMap(response); assertTrue(map.containsKey(WORKFLOW_ID)); assertEquals(workflowId1, map.get(WORKFLOW_ID).toString()); @@ -185,7 +185,7 @@ public void testWorkflowProvisionThrottle() throws Exception { // Another workflow should be fine otherWorkflowRequest = getRestRequestWithHeadersAndContent(otherTenantId, createNoOpTemplateWithDelayNodes(2)); response = makeRequest(otherWorkflowRequest, PUT, WORKFLOW_PATH + otherWorkflowId + "?reprovision=true"); - assertOK(response); + assertOkOrAccepted(response); map = responseToMap(response); assertTrue(map.containsKey(WORKFLOW_ID)); assertEquals(otherWorkflowId, map.get(WORKFLOW_ID).toString()); @@ -211,14 +211,14 @@ public void testWorkflowProvisionThrottle() throws Exception { // Reprovision should work now response = makeRequest(updateWorkflowRequest, PUT, WORKFLOW_PATH + workflowId2 + "?reprovision=true"); - assertOK(response); + assertOkOrAccepted(response); map = responseToMap(response); assertTrue(map.containsKey(WORKFLOW_ID)); assertEquals(workflowId2, map.get(WORKFLOW_ID).toString()); } else { // No throttling at all without multitenancy response = makeRequest(updateWorkflowRequest, PUT, WORKFLOW_PATH + workflowId2 + "?reprovision=true"); - assertOK(response); + assertOkOrAccepted(response); map = responseToMap(response); assertTrue(map.containsKey(WORKFLOW_ID)); assertEquals(workflowId2, map.get(WORKFLOW_ID).toString()); diff --git a/src/test/java/org/opensearch/flowframework/rest/RestWorkflowStateTenantAwareIT.java b/src/test/java/org/opensearch/flowframework/rest/RestWorkflowStateTenantAwareIT.java index 8ef54805..2a8e4ca7 100644 --- a/src/test/java/org/opensearch/flowframework/rest/RestWorkflowStateTenantAwareIT.java +++ b/src/test/java/org/opensearch/flowframework/rest/RestWorkflowStateTenantAwareIT.java @@ -152,7 +152,7 @@ public void testWorkflowStateCRUD() throws Exception { // Now finally provision the right way response = makeRequest(tenantRequest, POST, WORKFLOW_PATH + workflowId + PROVISION); - assertOK(response); + assertOkOrAccepted(response); map = responseToMap(response); assertTrue(map.containsKey(WORKFLOW_ID)); assertEquals(workflowId, map.get(WORKFLOW_ID).toString()); @@ -331,7 +331,7 @@ public void testWorkflowStateCRUD() throws Exception { // Create and provision second workflow using otherTenantId RestRequest otherWorkflowRequest = getRestRequestWithHeadersAndContent(otherTenantId, createRemoteModelTemplate()); response = makeRequest(otherWorkflowRequest, POST, WORKFLOW_URI + "?provision=true"); - assertOK(response); + assertOkOrAccepted(response); map = responseToMap(response); assertTrue(map.containsKey(WORKFLOW_ID)); String otherWorkflowId = map.get(WORKFLOW_ID).toString();