add debug logging to SpecificMasterNodesIT
Chasing https://github.com/elastic/elasticsearch/issues/25471 Also beefed up tests in TransportMasterNodeActionTests trying to simulate possible failures
This commit is contained in:
parent
3a59b6a16c
commit
17714acb9e
|
@ -299,19 +299,33 @@ public class TransportMasterNodeActionTests extends ESTestCase {
|
|||
|
||||
public void testDelegateToFailingMaster() throws ExecutionException, InterruptedException {
|
||||
boolean failsWithConnectTransportException = randomBoolean();
|
||||
boolean rejoinSameMaster = failsWithConnectTransportException && randomBoolean();
|
||||
Request request = new Request().masterNodeTimeout(TimeValue.timeValueSeconds(failsWithConnectTransportException ? 60 : 0));
|
||||
setState(clusterService, ClusterStateCreationUtils.state(localNode, remoteNode, allNodes));
|
||||
|
||||
PlainActionFuture<Response> listener = new PlainActionFuture<>();
|
||||
new Action(Settings.EMPTY, "testAction", transportService, clusterService, threadPool).execute(request, listener);
|
||||
|
||||
assertThat(transport.capturedRequests().length, equalTo(1));
|
||||
CapturingTransport.CapturedRequest capturedRequest = transport.capturedRequests()[0];
|
||||
CapturingTransport.CapturedRequest[] capturedRequests = transport.getCapturedRequestsAndClear();
|
||||
assertThat(capturedRequests.length, equalTo(1));
|
||||
CapturingTransport.CapturedRequest capturedRequest = capturedRequests[0];
|
||||
assertTrue(capturedRequest.node.isMasterNode());
|
||||
assertThat(capturedRequest.request, equalTo(request));
|
||||
assertThat(capturedRequest.action, equalTo("testAction"));
|
||||
|
||||
if (failsWithConnectTransportException) {
|
||||
if (rejoinSameMaster) {
|
||||
transport.handleRemoteError(capturedRequest.requestId, new ConnectTransportException(remoteNode, "Fake error"));
|
||||
assertFalse(listener.isDone());
|
||||
// reset the same state to increment a version simulating a join of an existing node
|
||||
setState(clusterService, clusterService.state());
|
||||
assertFalse(listener.isDone());
|
||||
capturedRequests = transport.getCapturedRequestsAndClear();
|
||||
assertThat(capturedRequests.length, equalTo(1));
|
||||
capturedRequest = capturedRequests[0];
|
||||
assertTrue(capturedRequest.node.isMasterNode());
|
||||
assertThat(capturedRequest.request, equalTo(request));
|
||||
assertThat(capturedRequest.action, equalTo("testAction"));
|
||||
} else if (failsWithConnectTransportException) {
|
||||
transport.handleRemoteError(capturedRequest.requestId, new ConnectTransportException(remoteNode, "Fake error"));
|
||||
assertFalse(listener.isDone());
|
||||
setState(clusterService, ClusterStateCreationUtils.state(localNode, localNode, allNodes));
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.elasticsearch.node.Node;
|
|||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
@ -40,6 +41,7 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
@ClusterScope(scope = Scope.TEST, numDataNodes = 0, autoMinMasterNodes = false)
|
||||
@TestLogging("_root:DEBUG,org.elasticsearch.action.admin.cluster.state:TRACE")
|
||||
public class SpecificMasterNodesIT extends ESIntegTestCase {
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue