Skip to content

Fix Broken Network Disruption in SnapshotResiliencyTests (#49216) #49232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2019
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 @@ -806,7 +807,9 @@ public void clearNetworkDisruptions() {
disconnectedNodes.forEach(nodeName -> {
if (testClusterNodes.nodes.containsKey(nodeName)) {
final DiscoveryNode node = testClusterNodes.nodes.get(nodeName).node;
testClusterNodes.nodes.values().forEach(n -> n.transportService.openConnection(node, null));
testClusterNodes.nodes.values().forEach(
n -> n.transportService.openConnection(node, null,
ActionTestUtils.assertNoFailureListener(c -> logger.debug("--> Connected [{}] to [{}]", n.node, node))));
}
});
}
Expand Down Expand Up @@ -899,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