Skip to content

Commit f849221

Browse files
authored
Merge pull request #66 from Bouncheck/patch-scylla-4.17.0.1
Add patch for scylla 4.17.0.1
2 parents 402711d + d176eaf commit f849221

File tree

2 files changed

+266
-0
lines changed

2 files changed

+266
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tests:
2+
# skipping cause of https://github.com/scylladb/scylla/issues/10956
3+
- BoundStatementCcmIT#should_set_all_occurrences_of_variable
4+
5+
# SSL based test are not configuring scylla correctly (https://github.com/scylladb/java-driver/issues/220)
6+
- DefaultSslEngineFactoryIT
7+
- DefaultSslEngineFactoryWithClientAuthIT

versions/scylla/4.17.0.1/patch

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
diff --git a/integration-tests/src/test/java/com/datastax/oss/driver/core/PeersV2NodeRefreshIT.java b/integration-tests/src/test/java/com/datastax/oss/driver/core/PeersV2NodeRefreshIT.java
2+
index 06ac14601..88ffdfcae 100644
3+
--- a/integration-tests/src/test/java/com/datastax/oss/driver/core/PeersV2NodeRefreshIT.java
4+
+++ b/integration-tests/src/test/java/com/datastax/oss/driver/core/PeersV2NodeRefreshIT.java
5+
@@ -27,6 +27,7 @@ import com.datastax.oss.simulacron.common.cluster.QueryLog;
6+
import com.datastax.oss.simulacron.server.BoundCluster;
7+
import com.datastax.oss.simulacron.server.Server;
8+
import java.util.concurrent.ExecutionException;
9+
+import org.junit.After;
10+
import org.junit.AfterClass;
11+
import org.junit.BeforeClass;
12+
import org.junit.Test;
13+
@@ -36,6 +37,7 @@ public class PeersV2NodeRefreshIT {
14+
15+
private static Server peersV2Server;
16+
private static BoundCluster cluster;
17+
+ private static CqlSession session;
18+
19+
@BeforeClass
20+
public static void setup() {
21+
@@ -53,6 +55,13 @@ public class PeersV2NodeRefreshIT {
22+
}
23+
}
24+
25+
+ @After
26+
+ public void closeSession() {
27+
+ if (session != null) {
28+
+ session.close();
29+
+ }
30+
+ }
31+
+
32+
@Test
33+
public void should_successfully_send_peers_v2_node_refresh_query()
34+
throws InterruptedException, ExecutionException {
35+
diff --git a/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/BaseCcmRule.java b/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/BaseCcmRule.java
36+
index 8537c89f8..0363926f6 100644
37+
--- a/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/BaseCcmRule.java
38+
+++ b/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/BaseCcmRule.java
39+
@@ -24,13 +24,18 @@ package com.datastax.oss.driver.api.testinfra.ccm;
40+
import com.datastax.oss.driver.api.core.DefaultProtocolVersion;
41+
import com.datastax.oss.driver.api.core.ProtocolVersion;
42+
import com.datastax.oss.driver.api.core.Version;
43+
+import com.datastax.oss.driver.api.core.metadata.EndPoint;
44+
import com.datastax.oss.driver.api.testinfra.*;
45+
import com.datastax.oss.driver.api.testinfra.CassandraResourceRule;
46+
import com.datastax.oss.driver.api.testinfra.requirement.BackendType;
47+
import com.datastax.oss.driver.api.testinfra.requirement.VersionRequirement;
48+
+import com.datastax.oss.driver.internal.core.metadata.DefaultEndPoint;
49+
+import java.net.InetSocketAddress;
50+
import java.util.Collection;
51+
+import java.util.Collections;
52+
import java.util.Objects;
53+
import java.util.Optional;
54+
+import java.util.Set;
55+
import org.junit.AssumptionViolatedException;
56+
import org.junit.runner.Description;
57+
import org.junit.runners.model.Statement;
58+
@@ -64,6 +69,13 @@ public abstract class BaseCcmRule extends CassandraResourceRule {
59+
ccmBridge.remove();
60+
}
61+
62+
+ @Override
63+
+ public Set<EndPoint> getContactPoints() {
64+
+ return Collections.singleton(
65+
+ new DefaultEndPoint(
66+
+ new InetSocketAddress(String.format("127.0.%s.1", ccmBridge.idPrefix), 9042)));
67+
+ }
68+
+
69+
private Statement buildErrorStatement(
70+
Version requirement, String description, boolean lessThan, boolean dse) {
71+
return new Statement() {
72+
diff --git a/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java b/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java
73+
index 074dcb6c0..f69f083b1 100644
74+
--- a/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java
75+
+++ b/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java
76+
@@ -62,6 +62,10 @@ public class CcmBridge implements AutoCloseable {
77+
public static final Version VERSION =
78+
Objects.requireNonNull(Version.parse(System.getProperty("ccm.version", "4.0.0")));
79+
80+
+ public String idPrefix = "0";
81+
+
82+
+ public static final String SCYLLA_VERSION = System.getProperty("scylla.version");
83+
+
84+
public static final String INSTALL_DIRECTORY = System.getProperty("ccm.directory");
85+
86+
public static final String BRANCH = System.getProperty("ccm.branch");
87+
@@ -171,7 +175,6 @@ public class CcmBridge implements AutoCloseable {
88+
private final Path configDirectory;
89+
private final AtomicBoolean started = new AtomicBoolean();
90+
private final AtomicBoolean created = new AtomicBoolean();
91+
- private final String ipPrefix;
92+
private final Map<String, Object> cassandraConfiguration;
93+
private final Map<String, Object> dseConfiguration;
94+
private final List<String> rawDseYaml;
95+
@@ -182,7 +185,7 @@ public class CcmBridge implements AutoCloseable {
96+
private CcmBridge(
97+
Path configDirectory,
98+
int[] nodes,
99+
- String ipPrefix,
100+
+ String idPrefix,
101+
Map<String, Object> cassandraConfiguration,
102+
Map<String, Object> dseConfiguration,
103+
List<String> dseConfigurationRawYaml,
104+
@@ -198,7 +201,7 @@ public class CcmBridge implements AutoCloseable {
105+
} else {
106+
this.nodes = nodes;
107+
}
108+
- this.ipPrefix = ipPrefix;
109+
+ this.idPrefix = idPrefix;
110+
this.cassandraConfiguration = cassandraConfiguration;
111+
this.dseConfiguration = dseConfiguration;
112+
this.rawDseYaml = dseConfigurationRawYaml;
113+
@@ -262,41 +265,6 @@ public class CcmBridge implements AutoCloseable {
114+
}
115+
}
116+
117+
- private String getCcmVersionString(Version version) {
118+
- if (SCYLLA_ENABLEMENT) {
119+
- // Scylla OSS versions before 5.1 had RC versioning scheme of 5.0.rc3.
120+
- // Scylla OSS versions after (and including 5.1) have RC versioning of 5.1.0-rc3.
121+
- // A similar situation occurs with Scylla Enterprise after 2022.2.
122+
- //
123+
- // CcmBridge parses the version numbers to a newer format (5.1.0-rc3), so a replacement
124+
- // must be performed for older Scylla version numbers.
125+
- String versionString = version.toString();
126+
-
127+
- boolean shouldReplace =
128+
- (SCYLLA_ENTERPRISE && version.compareTo(Version.parse("2022.2.0-rc0")) < 0)
129+
- || (!SCYLLA_ENTERPRISE && version.compareTo(Version.parse("5.1.0-rc0")) < 0);
130+
- if (shouldReplace) {
131+
- versionString = versionString.replace(".0-", ".");
132+
- }
133+
- return "release:" + versionString;
134+
- }
135+
- // for 4.0 pre-releases, the CCM version string needs to be "4.0-alpha1" or "4.0-alpha2"
136+
- // Version.toString() always adds a patch value, even if it's not specified when parsing.
137+
- if (version.getMajor() == 4
138+
- && version.getMinor() == 0
139+
- && version.getPatch() == 0
140+
- && version.getPreReleaseLabels() != null) {
141+
- // truncate the patch version from the Version string
142+
- StringBuilder sb = new StringBuilder();
143+
- sb.append(version.getMajor()).append('.').append(version.getMinor());
144+
- for (String preReleaseString : version.getPreReleaseLabels()) {
145+
- sb.append('-').append(preReleaseString);
146+
- }
147+
- return sb.toString();
148+
- }
149+
- return version.toString();
150+
- }
151+
-
152+
public void create() {
153+
if (created.compareAndSet(false, true)) {
154+
if (INSTALL_DIRECTORY != null) {
155+
@@ -305,7 +273,7 @@ public class CcmBridge implements AutoCloseable {
156+
createOptions.add("-v git:" + BRANCH.trim().replaceAll("\"", ""));
157+
158+
} else {
159+
- createOptions.add("-v " + getCcmVersionString(VERSION));
160+
+ createOptions.add("-v " + SCYLLA_VERSION);
161+
}
162+
if (DSE_ENABLEMENT) {
163+
createOptions.add("--dse");
164+
@@ -316,8 +284,8 @@ public class CcmBridge implements AutoCloseable {
165+
execute(
166+
"create",
167+
CLUSTER_NAME,
168+
- "-i",
169+
- ipPrefix,
170+
+ "--id",
171+
+ idPrefix,
172+
"-n",
173+
Arrays.stream(nodes).mapToObj(n -> "" + n).collect(Collectors.joining(":")),
174+
createOptions.stream().collect(Collectors.joining(" ")));
175+
@@ -417,9 +385,9 @@ public class CcmBridge implements AutoCloseable {
176+
177+
public void add(int n, String dc) {
178+
if (getDseVersion().isPresent()) {
179+
- execute("add", "-i", ipPrefix + n, "-d", dc, "node" + n, "--dse");
180+
+ execute("add", "-d", dc, "node" + n, "--dse");
181+
} else {
182+
- execute("add", "-i", ipPrefix + n, "-d", dc, "node" + n);
183+
+ execute("add", "-d", dc, "node" + n);
184+
}
185+
start(n);
186+
}
187+
@@ -525,7 +493,7 @@ public class CcmBridge implements AutoCloseable {
188+
private final Map<String, Object> dseConfiguration = new LinkedHashMap<>();
189+
private final List<String> dseRawYaml = new ArrayList<>();
190+
private final List<String> jvmArgs = new ArrayList<>();
191+
- private String ipPrefix = "127.0.0.";
192+
+ private String idPrefix = "0";
193+
private final List<String> createOptions = new ArrayList<>();
194+
private final List<String> dseWorkloads = new ArrayList<>();
195+
196+
@@ -569,8 +537,8 @@ public class CcmBridge implements AutoCloseable {
197+
return this;
198+
}
199+
200+
- public Builder withIpPrefix(String ipPrefix) {
201+
- this.ipPrefix = ipPrefix;
202+
+ public Builder withIdPrefix(String idPrefix) {
203+
+ this.idPrefix = idPrefix;
204+
return this;
205+
}
206+
207+
@@ -639,7 +607,7 @@ public class CcmBridge implements AutoCloseable {
208+
return new CcmBridge(
209+
configDirectory,
210+
nodes,
211+
- ipPrefix,
212+
+ idPrefix,
213+
cassandraConfiguration,
214+
dseConfiguration,
215+
dseRawYaml,
216+
diff --git a/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CustomCcmRule.java b/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CustomCcmRule.java
217+
index 4ea1b3843..45029cc10 100644
218+
--- a/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CustomCcmRule.java
219+
+++ b/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CustomCcmRule.java
220+
@@ -15,6 +15,7 @@
221+
*/
222+
package com.datastax.oss.driver.api.testinfra.ccm;
223+
224+
+import java.util.concurrent.atomic.AtomicInteger;
225+
import java.util.concurrent.atomic.AtomicReference;
226+
227+
/**
228+
@@ -30,6 +31,8 @@ public class CustomCcmRule extends BaseCcmRule {
229+
230+
private static final AtomicReference<CustomCcmRule> CURRENT = new AtomicReference<>();
231+
232+
+ private static AtomicInteger cluster_id = new AtomicInteger(1);
233+
+
234+
CustomCcmRule(CcmBridge ccmBridge) {
235+
super(ccmBridge);
236+
}
237+
@@ -62,6 +65,10 @@ public class CustomCcmRule extends BaseCcmRule {
238+
239+
private final CcmBridge.Builder bridgeBuilder = CcmBridge.builder();
240+
241+
+ public Builder() {
242+
+ this.withIdPrefix(Integer.toString(cluster_id.incrementAndGet()));
243+
+ }
244+
+
245+
public Builder withNodes(int... nodes) {
246+
bridgeBuilder.withNodes(nodes);
247+
return this;
248+
@@ -112,6 +119,11 @@ public class CustomCcmRule extends BaseCcmRule {
249+
return this;
250+
}
251+
252+
+ public Builder withIdPrefix(String idPrefix) {
253+
+ bridgeBuilder.withIdPrefix(idPrefix);
254+
+ return this;
255+
+ }
256+
+
257+
public CustomCcmRule build() {
258+
return new CustomCcmRule(bridgeBuilder.build());
259+
}

0 commit comments

Comments
 (0)