Skip to content

Commit

Permalink
Fix test RestStatusTests.testStatusReturnsFailureStatusWhenFailuresEx…
Browse files Browse the repository at this point in the history
…ist (#15011)

This test has a reproducible failure when the highest "failure" status
is 100 level. This happens because RestStatus.status treats these as OK.

Signed-off-by: Marc Handalian <[email protected]>
  • Loading branch information
mch2 authored Jul 30, 2024
1 parent 09276b3 commit f977f19
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ public void testStatusReturnsFailureStatusWhenFailuresExist() {
heapOfFailures.add(failure);
}

assertEquals(heapOfFailures.peek().status(), RestStatus.status(successfulShards, totalShards, failures));
final RestStatus status = heapOfFailures.peek().status();
// RestStatus.status will return RestStatus.OK when the highest failure code is 100 level.
final RestStatus expected = status.getStatusFamilyCode() == 1 ? RestStatus.OK : status;

assertEquals(expected, RestStatus.status(successfulShards, totalShards, failures));
}

public void testSerialization() throws IOException {
Expand Down

0 comments on commit f977f19

Please sign in to comment.