Skip to content

Commit 686e996

Browse files
committed
Fix RemovedNodeIT random behavior
`RemovedNodeIt#should_signal_and_destroy_pool_when_node_gets_removed` test starts 4 node cluster. Probably because of nodes starting in parallel it sometimes leads to the situation where two nodes own the same token. This throws the test off. Not only the driver sees one node as invalid, but also the assertion that expects 4 different token ranges fails, because there are only 3. To remediate that this change modifies the test to start the setup with 1 node and then sequentially add remaining 3 nodes with their `initial_token` explicitly set.
1 parent 663064f commit 686e996

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

integration-tests/src/test/java/com/datastax/oss/driver/core/session/RemovedNodeIT.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import com.datastax.oss.driver.api.core.metadata.Node;
2525
import com.datastax.oss.driver.api.core.metadata.NodeStateListener;
2626
import com.datastax.oss.driver.api.core.metadata.token.TokenRange;
27-
import com.datastax.oss.driver.api.testinfra.ScyllaSkip;
27+
import com.datastax.oss.driver.api.testinfra.ccm.CcmBridge;
2828
import com.datastax.oss.driver.api.testinfra.ccm.CustomCcmRule;
2929
import com.datastax.oss.driver.api.testinfra.session.SessionUtils;
3030
import com.datastax.oss.driver.internal.core.pool.ChannelPool;
@@ -33,20 +33,33 @@
3333
import java.util.Map;
3434
import java.util.Set;
3535
import java.util.concurrent.TimeUnit;
36+
import org.junit.Before;
3637
import org.junit.ClassRule;
3738
import org.junit.Test;
3839

39-
@ScyllaSkip(description = "@IntegrationTestDisabledFlaky")
4040
public class RemovedNodeIT {
4141

4242
@ClassRule
4343
public static final CustomCcmRule CCM_RULE =
4444
CustomCcmRule.builder()
4545
// We need 4 nodes to run this test against DSE, because it requires at least 3 nodes to
4646
// maintain RF=3 for keyspace system_distributed
47-
.withNodes(4)
47+
//
48+
// To avoid issue with flakiness of this test (scylladb/java-driver/issues/393) we start
49+
// with 1 node and manually start 3 more nodes with initial_token explicitly set.
50+
.withNodes(1)
4851
.build();
4952

53+
@Before
54+
public void setup() {
55+
CcmBridge ccmBridge = CCM_RULE.getCcmBridge();
56+
for (int nodeId = 2; nodeId <= 4; nodeId++) {
57+
ccmBridge.addWithoutStart(nodeId, "dc1");
58+
ccmBridge.updateNodeConfig(nodeId, "initial_token", String.valueOf(nodeId * 100));
59+
ccmBridge.start(nodeId);
60+
}
61+
}
62+
5063
@Test
5164
public void should_signal_and_destroy_pool_when_node_gets_removed() {
5265
RemovalListener removalListener = new RemovalListener();

0 commit comments

Comments
 (0)