Skip to content

Commit 6fa234d

Browse files
tomekl007olim7t
authored andcommitted
JAVA-2612: Fix ProtocolVersionMixedClusterIT (scylladb#38)
The control connection does not reconnect anymore when the protocol version is negotiated and downgraded, see JAVA-2473. This test was still expecting a reconnection, and thus was failing since.
1 parent a3051b4 commit 6fa234d

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

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

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import com.datastax.oss.simulacron.server.BoundCluster;
3535
import com.datastax.oss.simulacron.server.BoundNode;
3636
import com.datastax.oss.simulacron.server.BoundTopic;
37-
import java.net.InetSocketAddress;
3837
import java.util.stream.Stream;
3938
import org.junit.Rule;
4039
import org.junit.Test;
@@ -66,19 +65,12 @@ public void should_downgrade_if_peer_does_not_support_negotiated_version() {
6665
.build()) {
6766

6867
InternalDriverContext context = (InternalDriverContext) session.getContext();
68+
// General version should have been downgraded to V3
6969
assertThat(context.getProtocolVersion()).isEqualTo(DefaultProtocolVersion.V3);
70+
// But control connection should still be using protocol V4 since node0 supports V4
71+
assertThat(context.getControlConnection().channel().protocolVersion()).isEqualTo(DefaultProtocolVersion.V4);
7072

71-
// Find out which node became the control node after the reconnection (not necessarily node 0)
72-
InetSocketAddress controlAddress =
73-
(InetSocketAddress) context.getControlConnection().channel().getEndPoint().resolve();
74-
BoundNode currentControlNode = null;
75-
for (BoundNode node : simulacron.getNodes()) {
76-
if (node.inetSocketAddress().equals(controlAddress)) {
77-
currentControlNode = node;
78-
}
79-
}
80-
assertThat(currentControlNode).isNotNull();
81-
assertThat(queries(simulacron)).hasSize(8);
73+
assertThat(queries(simulacron)).hasSize(4);
8274

8375
assertThat(protocolQueries(contactPoint, 4))
8476
.containsExactly(
@@ -87,13 +79,6 @@ public void should_downgrade_if_peer_does_not_support_negotiated_version() {
8779
"SELECT * FROM system.local",
8880
"SELECT * FROM system.peers_v2",
8981
"SELECT * FROM system.peers");
90-
assertThat(protocolQueries(currentControlNode, 3))
91-
.containsExactly(
92-
// Reconnection with protocol v3
93-
"SELECT cluster_name FROM system.local",
94-
"SELECT * FROM system.local",
95-
"SELECT * FROM system.peers_v2",
96-
"SELECT * FROM system.peers");
9782
}
9883
}
9984

0 commit comments

Comments
 (0)