Skip to content

Commit

Permalink
Correctly assert against ALREADY_EXISTS index
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Kurait <[email protected]>
  • Loading branch information
AndreKurait committed Nov 25, 2024
1 parent 1c9ede8 commit fa7896e
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ private void verifyCommandResults(
assertThat(getNames(getSuccessfulResults(migratedItems.getIndexTemplates())), containsInAnyOrder(testData.indexTemplateName));
assertThat(getNames(getSuccessfulResults(migratedItems.getComponentTemplates())), equalTo(templateType.equals(TemplateType.IndexAndComponent) ? List.of(testData.compoTemplateName) : List.of()));
assertThat(getNames(getSuccessfulResults(migratedItems.getIndexes())), containsInAnyOrder(testData.blogIndexName, testData.movieIndexName, testData.indexThatAlreadyExists));
assertThat(getNames(getFailedResultsByType(migratedItems.getIndexes(), CreationResult.CreationFailureType.ALREADY_EXISTS)), containsInAnyOrder(testData.indexThatAlreadyExists));
assertThat(getNames(getSuccessfulResults(migratedItems.getAliases())), containsInAnyOrder(testData.aliasInTemplate, testData.aliasName));

}
Expand All @@ -219,6 +220,12 @@ private List<CreationResult> getSuccessfulResults(List<CreationResult> results)
.collect(Collectors.toList());
}

private List<CreationResult> getFailedResultsByType(List<CreationResult> results, CreationResult.CreationFailureType failureType) {
return results.stream()
.filter(r -> failureType.equals(r.getFailureType()))
.collect(Collectors.toList());
}

private List<String> getNames(List<CreationResult> items) {
return items.stream().map(r -> r.getName()).collect(Collectors.toList());
}
Expand Down

0 comments on commit fa7896e

Please sign in to comment.