Skip to content

Commit 6d6a35a

Browse files
Bouncheckavelanarius
authored andcommitted
Fix ConfigurationException in integration tests
CASSANDRA-15234 introduced several changes to cassandra.yaml This results in ConifugrationExceptions during ccm start. As a workaround this change adds as jvmArg "-Dcassandra.allow_new_old_config_keys=true" if the Cassandra version is at least 4.1.0 and this arg was not added yet. Additionally any config key explicitly added by driver code has been conditionally changed to new form depending on Cassandra version. JvmArg "-Dcassandra.allow_duplicate_config_keys=false" has been added to ensure that nothing gets implicitly overwritten with wrong value.
1 parent 834f231 commit 6d6a35a

4 files changed

Lines changed: 36 additions & 5 deletions

File tree

core/src/main/java/com/datastax/oss/driver/api/core/Version.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class Version implements Comparable<Version>, Serializable {
5050
@NonNull public static final Version V2_2_0 = Objects.requireNonNull(parse("2.2.0"));
5151
@NonNull public static final Version V3_0_0 = Objects.requireNonNull(parse("3.0.0"));
5252
@NonNull public static final Version V4_0_0 = Objects.requireNonNull(parse("4.0.0"));
53+
@NonNull public static final Version V4_1_0 = Objects.requireNonNull(parse("4.1.0"));
5354
@NonNull public static final Version V5_0_0 = Objects.requireNonNull(parse("5.0.0"));
5455
@NonNull public static final Version V6_7_0 = Objects.requireNonNull(parse("6.7.0"));
5556
@NonNull public static final Version V6_8_0 = Objects.requireNonNull(parse("6.8.0"));

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ public class SchemaChangesIT {
6060
CustomCcmRule.Builder builder = CustomCcmRule.builder();
6161
if (!CcmBridge.DSE_ENABLEMENT
6262
&& CcmBridge.VERSION.nextStable().compareTo(Version.V4_0_0) >= 0) {
63-
builder.withCassandraConfiguration("enable_materialized_views", true);
63+
if (CcmBridge.VERSION.nextStable().compareTo(Version.V4_1_0) >= 0) {
64+
builder.withCassandraConfiguration("materialized_views_enabled", true);
65+
} else {
66+
builder.withCassandraConfiguration("enable_materialized_views", true);
67+
}
6468
}
6569
CCM_RULE = builder.build();
6670
}

test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ private CcmBridge(
204204
this.rawDseYaml = dseConfigurationRawYaml;
205205
this.createOptions = createOptions;
206206

207+
if ((getCassandraVersion().nextStable().compareTo(Version.V4_1_0) >= 0)
208+
&& !jvmArgs.contains("-Dcassandra.allow_new_old_config_keys=false")
209+
&& !jvmArgs.contains("-Dcassandra.allow_new_old_config_keys=true")) {
210+
// FIXME: This should not be needed as soon as Scylla CCM adjusts to new names
211+
jvmArgs.add("-Dcassandra.allow_new_old_config_keys=true");
212+
jvmArgs.add("-Dcassandra.allow_duplicate_config_keys=false");
213+
}
207214
StringBuilder allJvmArgs = new StringBuilder("");
208215
String quote = isWindows() ? "\"" : "";
209216
for (String jvmArg : jvmArgs) {
@@ -324,7 +331,12 @@ public void create() {
324331
}
325332
if (getCassandraVersion().compareTo(Version.V2_2_0) >= 0 && !SCYLLA_ENABLEMENT) {
326333
// @IntegrationTestDisabledScyllaJVMArgs @IntegrationTestDisabledScyllaUDF
327-
updateConfArguments.append("enable_user_defined_functions:true").append(' ');
334+
if (getCassandraVersion().compareTo(Version.V4_1_0) >= 0) {
335+
updateConfArguments.append("user_defined_functions_enabled:true").append(' ');
336+
337+
} else {
338+
updateConfArguments.append("enable_user_defined_functions:true").append(' ');
339+
}
328340
}
329341

330342
if (updateConfArguments.length() > 0) {
@@ -387,7 +399,16 @@ public void resume(int n) {
387399
}
388400

389401
public void start(int n) {
390-
execute("node" + n, "start");
402+
// FIXME: This should not be needed as soon as Scylla CCM adjusts to new names
403+
if (getCassandraVersion().compareTo(Version.V4_1_0) >= 0) {
404+
execute(
405+
"node" + n,
406+
"start",
407+
"--jvm_arg=-Dcassandra.allow_new_old_config_keys=true",
408+
"--jvm_arg=-Dcassandra.allow_duplicate_config_keys=false");
409+
} else {
410+
execute("node" + n, "start");
411+
}
391412
}
392413

393414
public void stop(int n) {

test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/DefaultCcmBridgeBuilderCustomizer.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ public class DefaultCcmBridgeBuilderCustomizer {
3030
public static CcmBridge.Builder configureBuilder(CcmBridge.Builder builder) {
3131
if (!CcmBridge.DSE_ENABLEMENT
3232
&& CcmBridge.VERSION.nextStable().compareTo(Version.V4_0_0) >= 0) {
33-
builder.withCassandraConfiguration("enable_materialized_views", true);
34-
builder.withCassandraConfiguration("enable_sasi_indexes", true);
33+
if (CcmBridge.VERSION.nextStable().compareTo(Version.V4_1_0) >= 0) {
34+
builder.withCassandraConfiguration("materialized_views_enabled", true);
35+
builder.withCassandraConfiguration("sasi_indexes_enabled", true);
36+
} else {
37+
builder.withCassandraConfiguration("enable_materialized_views", true);
38+
builder.withCassandraConfiguration("enable_sasi_indexes", true);
39+
}
3540
}
3641
if (CcmBridge.VERSION.nextStable().compareTo(Version.V3_0_0) >= 0) {
3742
if (!CcmBridge.SCYLLA_ENABLEMENT) {

0 commit comments

Comments
 (0)