Skip to content

Commit

Permalink
Add change log, more test coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <[email protected]>
  • Loading branch information
dbwiddis committed Oct 2, 2024
1 parent 0064fbb commit 0907c21
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
- Add query assist data summary agent into sample templates ([#875](https://github.com/opensearch-project/flow-framework/pull/875))
### Maintenance
### Refactoring
- Update workflow state without using painless script ([#894](https://github.com/opensearch-project/flow-framework/pull/894))
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ public void testAddResourceToStateIndex() throws IOException {
exceptionCaptor.getValue().getMessage()
);

// test index not found
// test document not found
@SuppressWarnings("unchecked")
ActionListener<WorkflowData> notFoundListener = mock(ActionListener.class);
doAnswer(invocation -> {
Expand All @@ -632,6 +632,24 @@ public void testAddResourceToStateIndex() throws IOException {
verify(notFoundListener, times(1)).onFailure(exceptionCaptor.capture());
assertEquals("Workflow state not found for this_id", exceptionCaptor.getValue().getMessage());

// test index not found
when(mockMetaData.hasIndex(WORKFLOW_STATE_INDEX)).thenReturn(false);
@SuppressWarnings("unchecked")
ActionListener<WorkflowData> indexNotFoundListener = mock(ActionListener.class);
flowFrameworkIndicesHandler.addResourceToStateIndex(
new WorkflowData(Collections.emptyMap(), "this_id", null),
"node_id",
CreateConnectorStep.NAME,
"this_id",
indexNotFoundListener
);

exceptionCaptor = ArgumentCaptor.forClass(Exception.class);
verify(indexNotFoundListener, times(1)).onFailure(exceptionCaptor.capture());
assertEquals(
"Failed to update state for this_id due to missing .plugins-flow-framework-state index",
exceptionCaptor.getValue().getMessage()
);
}

public void testAddResourceToStateIndexWithRetries() throws IOException {
Expand Down

0 comments on commit 0907c21

Please sign in to comment.