Skip to content

Commit e70f0c9

Browse files
committed
Fix failing assumptions
1 parent 12f329e commit e70f0c9

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

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

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,22 @@
1616
package com.datastax.oss.driver.core.metadata;
1717

1818
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assumptions.assumeThat;
1920
import static org.awaitility.Awaitility.await;
2021
import static org.mockito.Mockito.mock;
2122
import static org.mockito.Mockito.verify;
2223

2324
import com.datastax.oss.driver.api.core.CqlIdentifier;
2425
import com.datastax.oss.driver.api.core.CqlSession;
26+
import com.datastax.oss.driver.api.core.Version;
2527
import com.datastax.oss.driver.api.core.config.DefaultDriverOption;
2628
import com.datastax.oss.driver.api.core.config.DriverConfigLoader;
2729
import com.datastax.oss.driver.api.core.metadata.Metadata;
2830
import com.datastax.oss.driver.api.core.metadata.schema.SchemaChangeListener;
2931
import com.datastax.oss.driver.api.core.type.DataTypes;
30-
import com.datastax.oss.driver.api.testinfra.CassandraRequirement;
32+
import com.datastax.oss.driver.api.testinfra.ccm.CcmBridge;
3133
import com.datastax.oss.driver.api.testinfra.ccm.CustomCcmRule;
34+
import com.datastax.oss.driver.api.testinfra.ccm.CustomCcmRule.Builder;
3235
import com.datastax.oss.driver.api.testinfra.session.SessionRule;
3336
import com.datastax.oss.driver.api.testinfra.session.SessionUtils;
3437
import com.google.common.collect.ImmutableList;
@@ -48,7 +51,16 @@
4851

4952
public class SchemaChangesIT {
5053

51-
private static final CustomCcmRule CCM_RULE = CustomCcmRule.builder().build();
54+
static {
55+
Builder builder = CustomCcmRule.builder();
56+
if (!CcmBridge.DSE_ENABLEMENT
57+
&& CcmBridge.VERSION.nextStable().compareTo(Version.V4_0_0) >= 0) {
58+
builder.withCassandraConfiguration("enable_materialized_views", true);
59+
}
60+
CCM_RULE = builder.build();
61+
}
62+
63+
private static final CustomCcmRule CCM_RULE;
5264

5365
// A client that we only use to set up the tests
5466
private static final SessionRule<CqlSession> ADMIN_SESSION_RULE =
@@ -227,8 +239,9 @@ public void should_handle_type_update() {
227239
}
228240

229241
@Test
230-
@CassandraRequirement(min = "3.0")
231242
public void should_handle_view_creation() {
243+
assumeThat(CCM_RULE.getCcmBridge().getCassandraVersion().compareTo(Version.V3_0_0) >= 0)
244+
.isTrue();
232245
should_handle_creation(
233246
"CREATE TABLE scores(user text, game text, score int, PRIMARY KEY (user, game))",
234247
"CREATE MATERIALIZED VIEW highscores "
@@ -257,8 +270,9 @@ public void should_handle_view_creation() {
257270
}
258271

259272
@Test
260-
@CassandraRequirement(min = "3.0")
261273
public void should_handle_view_drop() {
274+
assumeThat(CCM_RULE.getCcmBridge().getCassandraVersion().compareTo(Version.V3_0_0) >= 0)
275+
.isTrue();
262276
should_handle_drop(
263277
ImmutableList.of(
264278
"CREATE TABLE scores(user text, game text, score int, PRIMARY KEY (user, game))",
@@ -276,8 +290,9 @@ public void should_handle_view_drop() {
276290
}
277291

278292
@Test
279-
@CassandraRequirement(min = "3.0")
280293
public void should_handle_view_update() {
294+
assumeThat(CCM_RULE.getCcmBridge().getCassandraVersion().compareTo(Version.V3_0_0) >= 0)
295+
.isTrue();
281296
should_handle_update(
282297
ImmutableList.of(
283298
"CREATE TABLE scores(user text, game text, score int, PRIMARY KEY (user, game))",
@@ -298,8 +313,9 @@ public void should_handle_view_update() {
298313
}
299314

300315
@Test
301-
@CassandraRequirement(min = "2.2")
302316
public void should_handle_function_creation() {
317+
assumeThat(CCM_RULE.getCcmBridge().getCassandraVersion().compareTo(Version.V2_2_0) >= 0)
318+
.isTrue();
303319
should_handle_creation(
304320
null,
305321
"CREATE FUNCTION id(i int) RETURNS NULL ON NULL INPUT RETURNS int "
@@ -321,8 +337,9 @@ public void should_handle_function_creation() {
321337
}
322338

323339
@Test
324-
@CassandraRequirement(min = "2.2")
325340
public void should_handle_function_drop() {
341+
assumeThat(CCM_RULE.getCcmBridge().getCassandraVersion().compareTo(Version.V2_2_0) >= 0)
342+
.isTrue();
326343
should_handle_drop(
327344
ImmutableList.of(
328345
"CREATE FUNCTION id(i int) RETURNS NULL ON NULL INPUT RETURNS int "
@@ -336,8 +353,9 @@ public void should_handle_function_drop() {
336353
}
337354

338355
@Test
339-
@CassandraRequirement(min = "2.2")
340356
public void should_handle_function_update() {
357+
assumeThat(CCM_RULE.getCcmBridge().getCassandraVersion().compareTo(Version.V2_2_0) >= 0)
358+
.isTrue();
341359
should_handle_update_via_drop_and_recreate(
342360
ImmutableList.of(
343361
"CREATE FUNCTION id(i int) RETURNS NULL ON NULL INPUT RETURNS int "
@@ -355,8 +373,9 @@ public void should_handle_function_update() {
355373
}
356374

357375
@Test
358-
@CassandraRequirement(min = "2.2")
359376
public void should_handle_aggregate_creation() {
377+
assumeThat(CCM_RULE.getCcmBridge().getCassandraVersion().compareTo(Version.V2_2_0) >= 0)
378+
.isTrue();
360379
should_handle_creation(
361380
"CREATE FUNCTION plus(i int, j int) RETURNS NULL ON NULL INPUT RETURNS int "
362381
+ "LANGUAGE java AS 'return i+j;'",
@@ -380,8 +399,9 @@ public void should_handle_aggregate_creation() {
380399
}
381400

382401
@Test
383-
@CassandraRequirement(min = "2.2")
384402
public void should_handle_aggregate_drop() {
403+
assumeThat(CCM_RULE.getCcmBridge().getCassandraVersion().compareTo(Version.V2_2_0) >= 0)
404+
.isTrue();
385405
should_handle_drop(
386406
ImmutableList.of(
387407
"CREATE FUNCTION plus(i int, j int) RETURNS NULL ON NULL INPUT RETURNS int "
@@ -396,8 +416,9 @@ public void should_handle_aggregate_drop() {
396416
}
397417

398418
@Test
399-
@CassandraRequirement(min = "2.2")
400419
public void should_handle_aggregate_update() {
420+
assumeThat(CCM_RULE.getCcmBridge().getCassandraVersion().compareTo(Version.V2_2_0) >= 0)
421+
.isTrue();
401422
should_handle_update_via_drop_and_recreate(
402423
ImmutableList.of(
403424
"CREATE FUNCTION plus(i int, j int) RETURNS NULL ON NULL INPUT RETURNS int "

0 commit comments

Comments
 (0)