Skip to content

Commit

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

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


(cherry picked from commit f977f19)

Signed-off-by: Marc Handalian <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 04757db commit 5e2cd27
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 5e2cd27

Please sign in to comment.