Skip to content

Commit 1f163e1

Browse files
authoredMar 16, 2025··
Changed return code for RBAC and provision (#1083)
* Changed return code Signed-off-by: Owais <owaiskazi19@gmail.com> * Fixed tests Signed-off-by: Owais <owaiskazi19@gmail.com> --------- Signed-off-by: Owais <owaiskazi19@gmail.com>
1 parent 005029c commit 1f163e1

10 files changed

+42
-43
lines changed
 

‎CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
99

1010
### Enhancements
1111
### Bug Fixes
12+
- Change REST status codes for RBAC and provisioning ([#1083](https://github.com/opensearch-project/flow-framework/pull/1083))
13+
1214
### Infrastructure
1315
### Documentation
1416
### Maintenance

‎src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
253253

254254
return channel -> client.execute(CreateWorkflowAction.INSTANCE, workflowRequest, ActionListener.wrap(response -> {
255255
XContentBuilder builder = response.toXContent(channel.newBuilder(), ToXContent.EMPTY_PARAMS);
256-
channel.sendResponse(new BytesRestResponse(RestStatus.CREATED, builder));
256+
channel.sendResponse(new BytesRestResponse(provision || reprovision ? RestStatus.ACCEPTED : RestStatus.CREATED, builder));
257257
}, exception -> {
258258
try {
259259
FlowFrameworkException ex = exception instanceof FlowFrameworkException

‎src/main/java/org/opensearch/flowframework/rest/RestProvisionWorkflowAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
100100
);
101101
return channel -> client.execute(ProvisionWorkflowAction.INSTANCE, workflowRequest, ActionListener.wrap(response -> {
102102
XContentBuilder builder = response.toXContent(channel.newBuilder(), ToXContent.EMPTY_PARAMS);
103-
channel.sendResponse(new BytesRestResponse(RestStatus.OK, builder));
103+
channel.sendResponse(new BytesRestResponse(RestStatus.ACCEPTED, builder));
104104
}, exception -> {
105105
try {
106106
FlowFrameworkException ex = exception instanceof FlowFrameworkException

‎src/main/java/org/opensearch/flowframework/util/ParseUtils.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,7 @@ public static void onGetWorkflowResponse(
509509
} else {
510510
logger.debug("User: " + requestUser.getName() + " does not have permissions to access workflow: " + workflowId);
511511
listener.onFailure(
512-
new FlowFrameworkException(
513-
"User does not have permissions to access workflow: " + workflowId,
514-
RestStatus.BAD_REQUEST
515-
)
512+
new FlowFrameworkException("User does not have permissions to access workflow: " + workflowId, RestStatus.FORBIDDEN)
516513
);
517514
}
518515
} catch (Exception e) {

‎src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java

+19-19
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void testFailedUpdateWorkflow() throws Exception {
8989
String workflowId = (String) responseMap.get(WORKFLOW_ID);
9090

9191
Response provisionResponse = provisionWorkflow(client(), workflowId);
92-
assertEquals(RestStatus.OK, TestHelpers.restStatus(provisionResponse));
92+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(provisionResponse));
9393
getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS);
9494

9595
// Failed update since provisioning has started
@@ -111,7 +111,7 @@ public void testUpdateWorkflowUsingFields() throws Exception {
111111
String workflowId = (String) responseMap.get(WORKFLOW_ID);
112112

113113
Response provisionResponse = provisionWorkflow(client(), workflowId);
114-
assertEquals(RestStatus.OK, TestHelpers.restStatus(provisionResponse));
114+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(provisionResponse));
115115
getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS);
116116

117117
// Attempt to update with update_fields with illegal field
@@ -179,7 +179,7 @@ public void testCreateAndProvisionLocalModelWorkflow() throws Exception {
179179

180180
// Reattempt Provision
181181
response = provisionWorkflow(client(), workflowId);
182-
assertEquals(RestStatus.OK, TestHelpers.restStatus(response));
182+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
183183
getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS);
184184

185185
// Wait until provisioning has completed successfully before attempting to retrieve created resources
@@ -240,7 +240,7 @@ public void testCreateAndProvisionRemoteModelWorkflow() throws Exception {
240240
getAndAssertWorkflowStatus(client(), workflowId, State.NOT_STARTED, ProvisioningProgress.NOT_STARTED);
241241

242242
response = provisionWorkflow(client(), workflowId);
243-
assertEquals(RestStatus.OK, TestHelpers.restStatus(response));
243+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
244244
getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS);
245245

246246
// Wait until provisioning has completed successfully before attempting to retrieve created resources
@@ -270,7 +270,7 @@ public void testCreateAndProvisionAgentFrameworkWorkflow() throws Exception {
270270

271271
// Hit Create Workflow API to create agent-framework template, with template validation check and provision parameter
272272
Response response = createWorkflowWithProvision(client(), template);
273-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
273+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
274274
Map<String, Object> responseMap = entityAsMap(response);
275275
String workflowId = (String) responseMap.get(WORKFLOW_ID);
276276
// wait and ensure state is completed/done
@@ -345,7 +345,7 @@ public void testCreateAndProvisionConnectorToolAgentFrameworkWorkflow() throws E
345345

346346
// Hit Create Workflow API to create agent-framework template, with template validation check and provision parameter
347347
Response response = createWorkflowWithProvision(client(), template);
348-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
348+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
349349
Map<String, Object> responseMap = entityAsMap(response);
350350
String workflowId = (String) responseMap.get(WORKFLOW_ID);
351351
// wait and ensure state is completed/done
@@ -417,7 +417,7 @@ public void testReprovisionWorkflow() throws Exception {
417417
Template template = TestHelpers.createTemplateFromFile("registerremotemodel.json");
418418

419419
Response response = createWorkflowWithProvision(client(), template);
420-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
420+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
421421
Map<String, Object> responseMap = entityAsMap(response);
422422
String workflowId = (String) responseMap.get(WORKFLOW_ID);
423423
// wait and ensure state is completed/done
@@ -438,7 +438,7 @@ public void testReprovisionWorkflow() throws Exception {
438438
// Reprovision template to add ingest pipeline which uses the model ID
439439
template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline.json");
440440
response = reprovisionWorkflow(client(), workflowId, template);
441-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
441+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
442442

443443
resourcesCreated = getResourcesCreated(client(), workflowId, 30);
444444
assertEquals(4, resourcesCreated.size());
@@ -457,7 +457,7 @@ public void testReprovisionWorkflow() throws Exception {
457457
// Reprovision template to add index which uses default ingest pipeline
458458
template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json");
459459
response = reprovisionWorkflow(client(), workflowId, template);
460-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
460+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
461461

462462
resourcesCreated = getResourcesCreated(client(), workflowId, 30);
463463
assertEquals(5, resourcesCreated.size());
@@ -475,7 +475,7 @@ public void testReprovisionWorkflow() throws Exception {
475475
// Reprovision template to remove default ingest pipeline
476476
template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-updateindex.json");
477477
response = reprovisionWorkflow(client(), workflowId, template);
478-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
478+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
479479

480480
resourcesCreated = getResourcesCreated(client(), workflowId, 30);
481481
// resource count should remain unchanged when updating an existing node
@@ -504,7 +504,7 @@ public void testReprovisionWorkflowMidNodeAddition() throws Exception {
504504
Template template = TestHelpers.createTemplateFromFile("registerremotemodel-createindex.json");
505505

506506
Response response = createWorkflowWithProvision(client(), template);
507-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
507+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
508508
Map<String, Object> responseMap = entityAsMap(response);
509509
String workflowId = (String) responseMap.get(WORKFLOW_ID);
510510
// wait and ensure state is completed/done
@@ -526,7 +526,7 @@ public void testReprovisionWorkflowMidNodeAddition() throws Exception {
526526
// Reprovision template to add ingest pipeline which uses the model ID
527527
template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json");
528528
response = reprovisionWorkflow(client(), workflowId, template);
529-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
529+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
530530

531531
resourcesCreated = getResourcesCreated(client(), workflowId, 30);
532532
assertEquals(5, resourcesCreated.size());
@@ -565,7 +565,7 @@ public void testReprovisionWithNoChange() throws Exception {
565565
Template template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json");
566566

567567
Response response = createWorkflowWithProvision(client(), template);
568-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
568+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
569569
Map<String, Object> responseMap = entityAsMap(response);
570570
String workflowId = (String) responseMap.get(WORKFLOW_ID);
571571
// wait and ensure state is completed/done
@@ -602,7 +602,7 @@ public void testReprovisionWithDeletion() throws Exception {
602602
Template template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json");
603603

604604
Response response = createWorkflowWithProvision(client(), template);
605-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
605+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
606606
Map<String, Object> responseMap = entityAsMap(response);
607607
String workflowId = (String) responseMap.get(WORKFLOW_ID);
608608
// wait and ensure state is completed/done
@@ -670,7 +670,7 @@ public void testTimestamps() throws Exception {
670670

671671
// Provision the template, should have created and updated same as before and provisioned newer
672672
response = provisionWorkflow(client(), workflowId);
673-
assertEquals(RestStatus.OK.getStatus(), response.getStatusLine().getStatusCode());
673+
assertEquals(RestStatus.ACCEPTED.getStatus(), response.getStatusLine().getStatusCode());
674674

675675
response = getWorkflow(client(), workflowId);
676676
assertEquals(RestStatus.OK.getStatus(), response.getStatusLine().getStatusCode());
@@ -698,7 +698,7 @@ public void testCreateAndProvisionIngestAndSearchPipeline() throws Exception {
698698
getAndAssertWorkflowStatus(client(), workflowId, State.NOT_STARTED, ProvisioningProgress.NOT_STARTED);
699699

700700
response = provisionWorkflow(client(), workflowId);
701-
assertEquals(RestStatus.OK, TestHelpers.restStatus(response));
701+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
702702
getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS);
703703

704704
// Wait until provisioning has completed successfully before attempting to retrieve created resources
@@ -744,7 +744,7 @@ public void testDefaultCohereUseCase() throws Exception {
744744
getAndAssertWorkflowStatus(client(), workflowId, State.NOT_STARTED, ProvisioningProgress.NOT_STARTED);
745745

746746
response = provisionWorkflow(client(), workflowId);
747-
assertEquals(RestStatus.OK, TestHelpers.restStatus(response));
747+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
748748
getAndAssertWorkflowStatus(client(), workflowId, State.PROVISIONING, ProvisioningProgress.IN_PROGRESS);
749749

750750
// Wait until provisioning has completed successfully before attempting to retrieve created resources
@@ -788,7 +788,7 @@ public void testDefaultSemanticSearchUseCaseWithFailureExpected() throws Excepti
788788
getAndAssertWorkflowStatus(client(), workflowId, State.NOT_STARTED, ProvisioningProgress.NOT_STARTED);
789789

790790
response = provisionWorkflow(client(), workflowId);
791-
assertEquals(RestStatus.OK, TestHelpers.restStatus(response));
791+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
792792
getAndAssertWorkflowStatus(client(), workflowId, State.FAILED, ProvisioningProgress.FAILED);
793793
}
794794

@@ -824,7 +824,7 @@ public void testSemanticSearchWithLocalModelEndToEnd() throws Exception {
824824
defaults.put("text_embedding.field_map.output.dimension", 384);
825825

826826
Response response = createAndProvisionWorkflowWithUseCaseWithContent(client(), "semantic_search_with_local_model", defaults);
827-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
827+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
828828

829829
Map<String, Object> responseMap = entityAsMap(response);
830830
String workflowId = (String) responseMap.get(WORKFLOW_ID);

‎src/test/java/org/opensearch/flowframework/rest/FlowFrameworkSecureRestApiIT.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ public void testProvisionWorkflowWithWriteAccess() throws Exception {
323323
Map<String, Object> responseMap = entityAsMap(aliceWorkflow);
324324
String workflowId = (String) responseMap.get(WORKFLOW_ID);
325325
Response response = provisionWorkflow(aliceClient, workflowId);
326-
assertEquals(RestStatus.OK, TestHelpers.restStatus(response));
326+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
327327
}
328328

329329
public void testReprovisionWorkflowWithWriteAccess() throws Exception {
@@ -333,7 +333,7 @@ public void testReprovisionWorkflowWithWriteAccess() throws Exception {
333333

334334
enableFilterBy();
335335
Response response = createWorkflowWithProvision(aliceClient, template);
336-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
336+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
337337

338338
Map<String, Object> responseMap = entityAsMap(response);
339339
String workflowId = (String) responseMap.get(WORKFLOW_ID);
@@ -356,7 +356,7 @@ public void testReprovisionWorkflowWithWriteAccess() throws Exception {
356356
// Reprovision template to add ingest pipeline which uses the model ID
357357
template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json");
358358
response = reprovisionWorkflow(aliceClient, workflowId, template);
359-
assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response));
359+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
360360

361361
resourcesCreated = getResourcesCreated(aliceClient, workflowId, 30);
362362
assertEquals(5, resourcesCreated.size());
@@ -426,7 +426,7 @@ public void testCreateProvisionDeprovisionWorkflowWithFullAccess() throws Except
426426
} else {
427427
response = provisionWorkflow(aliceClient, workflowId);
428428
}
429-
assertEquals(RestStatus.OK, TestHelpers.restStatus(response));
429+
assertEquals(RestStatus.ACCEPTED, TestHelpers.restStatus(response));
430430

431431
// Invoke status API
432432
response = getWorkflowStatus(aliceClient, workflowId, false);

‎src/test/java/org/opensearch/flowframework/rest/RestCreateWorkflowActionTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void testCreateWorkflowRequestWithParamsAndProvision() throws Exception {
126126
return null;
127127
}).when(nodeClient).execute(any(), any(WorkflowRequest.class), any());
128128
createWorkflowRestAction.handleRequest(request, channel, nodeClient);
129-
assertEquals(RestStatus.CREATED, channel.capturedResponse().status());
129+
assertEquals(RestStatus.ACCEPTED, channel.capturedResponse().status());
130130
assertTrue(channel.capturedResponse().content().utf8ToString().contains("id-123"));
131131
}
132132

@@ -146,7 +146,7 @@ public void testRestCreateWorkflowWithWaitForCompletionTimeout() throws Exceptio
146146

147147
createWorkflowRestAction.handleRequest(request, channel, nodeClient);
148148

149-
assertEquals(RestStatus.CREATED, channel.capturedResponse().status());
149+
assertEquals(RestStatus.ACCEPTED, channel.capturedResponse().status());
150150
assertTrue(channel.capturedResponse().content().utf8ToString().contains("workflow_1"));
151151
}
152152

‎src/test/java/org/opensearch/flowframework/rest/RestProvisionWorkflowActionTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void testContentParsing() throws Exception {
9191
return null;
9292
}).when(nodeClient).execute(any(), any(WorkflowRequest.class), any());
9393
provisionWorkflowRestAction.handleRequest(request, channel, nodeClient);
94-
assertEquals(RestStatus.OK, channel.capturedResponse().status());
94+
assertEquals(RestStatus.ACCEPTED, channel.capturedResponse().status());
9595
assertTrue(channel.capturedResponse().content().utf8ToString().contains("id-123"));
9696
}
9797

@@ -162,7 +162,7 @@ public void testProvisionWorkflowWithValidWaitForCompletionTimeout() throws Exce
162162

163163
provisionWorkflowRestAction.handleRequest(request, channel, nodeClient);
164164

165-
assertEquals(RestStatus.OK, channel.capturedResponse().status());
165+
assertEquals(RestStatus.ACCEPTED, channel.capturedResponse().status());
166166
assertTrue(channel.capturedResponse().content().utf8ToString().contains("workflow_1"));
167167
}
168168

‎src/test/java/org/opensearch/flowframework/rest/RestWorkflowProvisionTenantAwareIT.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ public void testWorkflowProvisionThrottle() throws Exception {
9797
*/
9898
// Kick off a provisioning
9999
response = makeRequest(tenantRequest, POST, WORKFLOW_PATH + workflowId1 + PROVISION);
100-
assertOK(response);
100+
assertOkOrAccepted(response);
101101
map = responseToMap(response);
102102
assertTrue(map.containsKey(WORKFLOW_ID));
103103
assertEquals(workflowId1, map.get(WORKFLOW_ID).toString());
104104
// During the 3 second async provisioning, try another one
105105
// Another workflow should be fine
106106
response = makeRequest(otherTenantRequest, POST, WORKFLOW_PATH + otherWorkflowId + PROVISION);
107-
assertOK(response);
107+
assertOkOrAccepted(response);
108108
map = responseToMap(response);
109109
assertTrue(map.containsKey(WORKFLOW_ID));
110110
assertEquals(otherWorkflowId, map.get(WORKFLOW_ID).toString());
@@ -130,14 +130,14 @@ public void testWorkflowProvisionThrottle() throws Exception {
130130

131131
// Provision should work now
132132
response = makeRequest(tenantRequest, POST, WORKFLOW_PATH + workflowId2 + PROVISION);
133-
assertOK(response);
133+
assertOkOrAccepted(response);
134134
map = responseToMap(response);
135135
assertTrue(map.containsKey(WORKFLOW_ID));
136136
assertEquals(workflowId2, map.get(WORKFLOW_ID).toString());
137137
} else {
138138
// No throttling at all without multitenancy
139139
response = makeRequest(tenantRequest, POST, WORKFLOW_PATH + workflowId2 + PROVISION);
140-
assertOK(response);
140+
assertOkOrAccepted(response);
141141
map = responseToMap(response);
142142
assertTrue(map.containsKey(WORKFLOW_ID));
143143
assertEquals(workflowId2, map.get(WORKFLOW_ID).toString());
@@ -176,7 +176,7 @@ public void testWorkflowProvisionThrottle() throws Exception {
176176
// Reprovision a workflow with a tenant id
177177
RestRequest updateWorkflowRequest = getRestRequestWithHeadersAndContent(tenantId, createNoOpTemplateWithDelayNodes(2));
178178
response = makeRequest(updateWorkflowRequest, PUT, WORKFLOW_PATH + workflowId1 + "?reprovision=true");
179-
assertOK(response);
179+
assertOkOrAccepted(response);
180180
map = responseToMap(response);
181181
assertTrue(map.containsKey(WORKFLOW_ID));
182182
assertEquals(workflowId1, map.get(WORKFLOW_ID).toString());
@@ -185,7 +185,7 @@ public void testWorkflowProvisionThrottle() throws Exception {
185185
// Another workflow should be fine
186186
otherWorkflowRequest = getRestRequestWithHeadersAndContent(otherTenantId, createNoOpTemplateWithDelayNodes(2));
187187
response = makeRequest(otherWorkflowRequest, PUT, WORKFLOW_PATH + otherWorkflowId + "?reprovision=true");
188-
assertOK(response);
188+
assertOkOrAccepted(response);
189189
map = responseToMap(response);
190190
assertTrue(map.containsKey(WORKFLOW_ID));
191191
assertEquals(otherWorkflowId, map.get(WORKFLOW_ID).toString());
@@ -211,14 +211,14 @@ public void testWorkflowProvisionThrottle() throws Exception {
211211

212212
// Reprovision should work now
213213
response = makeRequest(updateWorkflowRequest, PUT, WORKFLOW_PATH + workflowId2 + "?reprovision=true");
214-
assertOK(response);
214+
assertOkOrAccepted(response);
215215
map = responseToMap(response);
216216
assertTrue(map.containsKey(WORKFLOW_ID));
217217
assertEquals(workflowId2, map.get(WORKFLOW_ID).toString());
218218
} else {
219219
// No throttling at all without multitenancy
220220
response = makeRequest(updateWorkflowRequest, PUT, WORKFLOW_PATH + workflowId2 + "?reprovision=true");
221-
assertOK(response);
221+
assertOkOrAccepted(response);
222222
map = responseToMap(response);
223223
assertTrue(map.containsKey(WORKFLOW_ID));
224224
assertEquals(workflowId2, map.get(WORKFLOW_ID).toString());

‎src/test/java/org/opensearch/flowframework/rest/RestWorkflowStateTenantAwareIT.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public void testWorkflowStateCRUD() throws Exception {
152152

153153
// Now finally provision the right way
154154
response = makeRequest(tenantRequest, POST, WORKFLOW_PATH + workflowId + PROVISION);
155-
assertOK(response);
155+
assertOkOrAccepted(response);
156156
map = responseToMap(response);
157157
assertTrue(map.containsKey(WORKFLOW_ID));
158158
assertEquals(workflowId, map.get(WORKFLOW_ID).toString());
@@ -331,7 +331,7 @@ public void testWorkflowStateCRUD() throws Exception {
331331
// Create and provision second workflow using otherTenantId
332332
RestRequest otherWorkflowRequest = getRestRequestWithHeadersAndContent(otherTenantId, createRemoteModelTemplate());
333333
response = makeRequest(otherWorkflowRequest, POST, WORKFLOW_URI + "?provision=true");
334-
assertOK(response);
334+
assertOkOrAccepted(response);
335335
map = responseToMap(response);
336336
assertTrue(map.containsKey(WORKFLOW_ID));
337337
String otherWorkflowId = map.get(WORKFLOW_ID).toString();

0 commit comments

Comments
 (0)
Please sign in to comment.