Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import org.elasticsearch.action.search.SearchTransportService;
import org.elasticsearch.action.search.TransportSearchAction;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.ActionTestUtils;
import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.action.support.AutoCreateIndex;
import org.elasticsearch.action.support.DestructiveOperations;
Expand Down Expand Up @@ -713,7 +714,7 @@ private final class TestClusterNodes {
private final Map<String, TestClusterNode> nodes = new LinkedHashMap<>();

/**
* Node ids that are disconnected from all other nodes.
* Node names that are disconnected from all other nodes.
*/
private final Set<String> disconnectedNodes = new HashSet<>();

Expand Down Expand Up @@ -793,11 +794,11 @@ public Optional<TestClusterNode> randomDataNode(String... excludedNames) {
}

public void disconnectNode(TestClusterNode node) {
if (disconnectedNodes.contains(node.node.getId())) {
if (disconnectedNodes.contains(node.node.getName())) {
return;
}
testClusterNodes.nodes.values().forEach(n -> n.transportService.getConnectionManager().disconnectFromNode(node.node));
disconnectedNodes.add(node.node.getId());
disconnectedNodes.add(node.node.getName());
}

public void clearNetworkDisruptions() {
Expand All @@ -807,7 +808,8 @@ public void clearNetworkDisruptions() {
if (testClusterNodes.nodes.containsKey(nodeName)) {
final DiscoveryNode node = testClusterNodes.nodes.get(nodeName).node;
testClusterNodes.nodes.values().forEach(
n -> n.transportService.openConnection(node, null, ActionListener.wrap(() -> {})));
n -> n.transportService.openConnection(node, null,
ActionTestUtils.assertNoFailureListener(c -> logger.debug("--> Connected [{}] to [{}]", n.node, node))));
}
});
}
Expand Down Expand Up @@ -900,7 +902,7 @@ protected ConnectionStatus getConnectionStatus(DiscoveryNode destination) {
if (nodes.containsKey(node.getName()) == false || nodes.containsKey(destination.getName()) == false) {
return ConnectionStatus.DISCONNECTED;
}
return disconnectedNodes.contains(node.getId()) || disconnectedNodes.contains(destination.getId())
return disconnectedNodes.contains(node.getName()) || disconnectedNodes.contains(destination.getName())
? ConnectionStatus.DISCONNECTED : ConnectionStatus.CONNECTED;
}

Expand Down