Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsbauman committed Jun 10, 2024
1 parent 16f5e34 commit e29d3d5
Showing 1 changed file with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,24 +353,20 @@ public void testRemoveFailureStoreIndexThatDoesNotExist() {

public void testRemoveFailureStoreWriteIndex() {
DataStream original = createRandomDataStream();
int indexToRemove = original.getFailureIndices().getIndices().size() - 1;

IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
() -> original.removeFailureStoreIndex(
original.getFailureIndices().getIndices().get(original.getFailureIndices().getIndices().size() - 1)
)
);
assertThat(
e.getMessage(),
equalTo(
String.format(
Locale.ROOT,
"cannot remove backing index [%s] of data stream [%s] because it is the write index of the failure store",
original.getFailureIndices().getIndices().get(original.getFailureIndices().getIndices().size() - 1).getName(),
original.getName()
)
)
);
DataStream updated = original.removeFailureStoreIndex(original.getFailureIndices().getIndices().get(indexToRemove));
assertThat(updated.getName(), equalTo(original.getName()));
assertThat(updated.getGeneration(), equalTo(original.getGeneration() + 1));
assertThat(updated.getIndices().size(), equalTo(original.getIndices().size()));
assertThat(updated.getFailureIndices().getIndices().size(), equalTo(original.getFailureIndices().getIndices().size() - 1));
assertThat(updated.getFailureIndices().isRolloverOnWrite(), equalTo(true));
for (int k = 0; k < (original.getFailureIndices().getIndices().size() - 1); k++) {
assertThat(
updated.getFailureIndices().getIndices().get(k),
equalTo(original.getFailureIndices().getIndices().get(k))
);
};
}

public void testAddBackingIndex() {
Expand Down

0 comments on commit e29d3d5

Please sign in to comment.