From 276f3b8836c4b82bdc174d68e9fabcf83abc4f0a Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 9 Oct 2024 06:59:38 +0100 Subject: [PATCH] Avoid leaking blackholed register ops in tests (#114287) Today when we reboot a node in a test case derived from `AbstractCoordinatorTestCase` we lose the contents of `blackholedRegisterOperations`, but it's important that these operations _eventually_ run. With this commit we copy these operations over into the new node. --- .../cluster/coordination/AbstractCoordinatorTestCase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/framework/src/main/java/org/elasticsearch/cluster/coordination/AbstractCoordinatorTestCase.java b/test/framework/src/main/java/org/elasticsearch/cluster/coordination/AbstractCoordinatorTestCase.java index 262dba80caa24..ddfa61b53a0af 100644 --- a/test/framework/src/main/java/org/elasticsearch/cluster/coordination/AbstractCoordinatorTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/cluster/coordination/AbstractCoordinatorTestCase.java @@ -1250,7 +1250,7 @@ ClusterNode restartedNode( .roles(localNode.isMasterNode() && DiscoveryNode.isMasterNode(settings) ? ALL_ROLES_EXCEPT_VOTING_ONLY : emptySet()) .build(); try { - return new ClusterNode( + final var restartedNode = new ClusterNode( nodeIndex, newLocalNode, (node, threadPool) -> createPersistedStateFromExistingState( @@ -1263,6 +1263,8 @@ ClusterNode restartedNode( settings, nodeHealthService ); + restartedNode.blackholedRegisterOperations.addAll(blackholedRegisterOperations); + return restartedNode; } finally { clearableRecycler.clear(); }