Skip to content

Commit

Permalink
Remove the constructor with a single return200ForServerTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
arteam committed Oct 18, 2021
1 parent 7bc6f0c commit 6b672f5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo
private ClusterHealthStatus clusterHealthStatus;
private boolean return200ForClusterHealthTimeout;

public ClusterHealthResponse(boolean return200ForServerTimeout) {
this.return200ForClusterHealthTimeout = return200ForServerTimeout;
}

public ClusterHealthResponse(StreamInput in) throws IOException {
super(in);
clusterName = in.readString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class ClusterHealthResponsesTests extends AbstractSerializingTestCase<Clu
private final ClusterHealthRequest.Level level = randomFrom(ClusterHealthRequest.Level.values());

public void testIsTimeout() {
ClusterHealthResponse res = new ClusterHealthResponse(false);
ClusterHealthResponse res = new ClusterHealthResponse("", new String[]{}, ClusterState.EMPTY_STATE, false);
for (int i = 0; i < 5; i++) {
res.setTimedOut(randomBoolean());
if (res.isTimedOut()) {
Expand All @@ -56,7 +56,7 @@ public void testIsTimeout() {
}

public void testTimeoutReturns200IfOptedIn() {
ClusterHealthResponse res = new ClusterHealthResponse(true);
ClusterHealthResponse res = new ClusterHealthResponse("", new String[]{}, ClusterState.EMPTY_STATE, true);
for (int i = 0; i < 5; i++) {
res.setTimedOut(randomBoolean());
assertEquals(RestStatus.OK, res.status());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void setUpMocks() {
clusterAdminClient = mock(ClusterAdminClient.class);
doAnswer(invocationOnMock -> {
ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) invocationOnMock.getArguments()[1];
listener.onResponse(new ClusterHealthResponse(false));
listener.onResponse(new ClusterHealthResponse("", new String[]{}, ClusterState.EMPTY_STATE, false));
return null;
}).when(clusterAdminClient).health(any(ClusterHealthRequest.class), any(ActionListener.class));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public void testCreateLatestVersionedIndexIfRequired_GivenShardInitializationPen
doAnswer(invocationOnMock -> {
@SuppressWarnings("unchecked")
ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) invocationOnMock.getArguments()[1];
listener.onResponse(new ClusterHealthResponse(false));
listener.onResponse(new ClusterHealthResponse("", new String[]{}, ClusterState.EMPTY_STATE, false));
return null;
}).when(clusterClient).health(any(), any());

Expand Down Expand Up @@ -272,7 +272,7 @@ public void testCreateLatestVersionedIndexIfRequired_GivenConcurrentCreationShar
doAnswer(invocationOnMock -> {
@SuppressWarnings("unchecked")
ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) invocationOnMock.getArguments()[1];
listener.onResponse(new ClusterHealthResponse(false));
listener.onResponse(new ClusterHealthResponse("", new String[]{}, ClusterState.EMPTY_STATE, false));
return null;
}).when(clusterClient).health(any(), any());

Expand Down

0 comments on commit 6b672f5

Please sign in to comment.