Skip to content

Commit 060d07d

Browse files
authored
Reinstate testUnhealthyNodesGetsRemoved for stateless (#95404)
1 parent e7ab32f commit 060d07d

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

server/src/test/java/org/elasticsearch/cluster/coordination/AtomicRegisterCoordinatorTests.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@
4242

4343
@TestLogging(reason = "these tests do a lot of log-worthy things but we usually don't care", value = "org.elasticsearch:FATAL")
4444
public class AtomicRegisterCoordinatorTests extends CoordinatorTests {
45-
@Override
46-
@AwaitsFix(bugUrl = "ES-5645")
47-
public void testUnhealthyNodesGetsRemoved() {
48-
// This test checks that the voting configuration shrinks after a node is removed from the cluster
49-
// TODO: rewrite this test without taking into account the final voting configuration
50-
}
51-
5245
@Override
5346
@AwaitsFix(bugUrl = "ES-5645")
5447
public void testLeaderDisconnectionWithDisconnectEventDetectedQuickly() {
@@ -147,6 +140,12 @@ public void testCannotJoinClusterWithDifferentUUID() {
147140
// TODO: add more checks to avoid forming a mixed cluster between register based and traditional clusters
148141
}
149142

143+
@Override
144+
public void testUnhealthyNodesGetsRemoved() {
145+
// the test still applies with an atomic register, except for the assertions about the voting configuration
146+
testUnhealthyNodesGetsRemoved(false);
147+
}
148+
150149
@Override
151150
public void testJoiningNodeReceivesFullState() {
152151
try (Cluster cluster = new Cluster(randomIntBetween(1, 5))) {

server/src/test/java/org/elasticsearch/cluster/coordination/CoordinatorTests.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ public void testDoesNotElectNonMasterNode() {
123123
}
124124

125125
public void testUnhealthyNodesGetsRemoved() {
126+
testUnhealthyNodesGetsRemoved(true);
127+
}
128+
129+
protected void testUnhealthyNodesGetsRemoved(boolean verifyVotingConfiguration) {
126130
AtomicReference<StatusInfo> healthStatusInfo = new AtomicReference<>(new StatusInfo(HEALTHY, "healthy-info"));
127131
try (Cluster cluster = new Cluster(3)) {
128132
cluster.runRandomly();
@@ -148,7 +152,7 @@ public void testUnhealthyNodesGetsRemoved() {
148152
+ 2 * 2 * DEFAULT_CLUSTER_STATE_UPDATE_DELAY
149153
);
150154

151-
{
155+
if (verifyVotingConfiguration) {
152156
assertThat(leader.coordinator.getMode(), is(Mode.LEADER));
153157
final VotingConfiguration lastCommittedConfiguration = leader.getLastAppliedClusterState().getLastCommittedConfiguration();
154158
assertThat(
@@ -190,7 +194,8 @@ public void testUnhealthyNodesGetsRemoved() {
190194
// then wait for the followup reconfiguration
191195
+ DEFAULT_CLUSTER_STATE_UPDATE_DELAY
192196
);
193-
{
197+
198+
if (verifyVotingConfiguration) {
194199
final ClusterNode newLeader = cluster.getAnyLeader();
195200
final VotingConfiguration lastCommittedConfiguration = newLeader.getLastAppliedClusterState()
196201
.getLastCommittedConfiguration();

0 commit comments

Comments
 (0)