Skip to content

Commit

Permalink
Added a specific test to expect exception wehn accessing the closed i…
Browse files Browse the repository at this point in the history
…ndices stats

Signed-off-by: srikanth padakanti <srikanth29.9@gmail.com>
  • Loading branch information
srikanthpadakanti committed Apr 4, 2024
1 parent cbd4ba8 commit 71f5199
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,35 @@ public void testFromOptions() {
}
}

public void testIllegalArgumentExceptionForClosedIndices() {
final boolean ignoreUnavailable = randomBoolean();
final boolean allowNoIndices = randomBoolean();
final boolean expandToOpenIndices = randomBoolean();
final boolean expandToClosedIndices = true;
final boolean expandToHiddenIndices = randomBoolean();
final boolean allowAliasesToMultipleIndices = randomBoolean();
final boolean forbidClosedIndices = true;
final boolean ignoreAliases = randomBoolean();
final boolean ignoreThrottled = randomBoolean();

IllegalArgumentException iae = expectThrows(
IllegalArgumentException.class,
() -> IndicesOptions.fromOptions(
ignoreUnavailable,
allowNoIndices,
expandToOpenIndices,
expandToClosedIndices,
expandToHiddenIndices,
allowAliasesToMultipleIndices,
forbidClosedIndices,
ignoreAliases,
ignoreThrottled
)
);
String expectedMessage = "To expand [" + WildcardStates.CLOSED + "] wildcard, please set forbid_closed_indices to `false` ";
assertEquals(expectedMessage, iae.getMessage());
}

public void testFromOptionsWithDefaultOptions() {
boolean ignoreUnavailable = randomBoolean();
boolean allowNoIndices = randomBoolean();
Expand Down

0 comments on commit 71f5199

Please sign in to comment.