Skip to content

Commit fd4e154

Browse files
authored
CPP-971 Fix for beta protocol support in integration tests (#543)
1 parent 67b7526 commit fd4e154

File tree

6 files changed

+28
-20
lines changed

6 files changed

+28
-20
lines changed

tests/src/integration/ccm/bridge.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,11 @@ CCM::Bridge::generate_create_updateconf_command(CassVersion cassandra_version) {
14911491
updateconf_command.push_back("enable_scripted_user_defined_functions:true");
14921492
}
14931493

1494+
if (cassandra_version >= "4.0.0") {
1495+
updateconf_command.push_back("enable_materialized_views:true");
1496+
updateconf_command.push_back("enable_user_defined_functions:true");
1497+
}
1498+
14941499
return updateconf_command;
14951500
}
14961501

tests/src/integration/integration.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,7 @@ test::driver::Cluster Integration::default_cluster(bool is_with_default_contact_
373373
if (is_with_default_contact_points) {
374374
cluster.with_contact_points(contact_points_);
375375
}
376-
if (Options::is_cassandra() && server_version_ >= "4.0" &&
377-
protocol_version_ == CASS_PROTOCOL_VERSION_V4) {
378-
cluster.with_beta_protocol(is_beta_protocol_);
379-
} else {
380-
cluster.with_protocol_version(protocol_version_);
381-
}
376+
cluster.with_protocol_version(protocol_version_);
382377

383378
// Assign the execution profiles to the cluster object (if available)
384379
for (ExecutionProfile::Map::iterator it = profiles_.begin(); it != profiles_.end(); ++it) {

tests/src/integration/integration.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@
9494
} \
9595
} while (0)
9696

97+
#define CHECK_PROTOCOL_VERSION(version) \
98+
do { \
99+
int proto_version = this->protocol_version_; \
100+
if (proto_version < version) { \
101+
SKIP_TEST_VERSION(std::to_string(proto_version), #version) \
102+
} \
103+
} while (0)
104+
97105
#define CHECK_OPTIONS_VERSION(version) \
98106
if (Options::server_version() < #version) { \
99107
SKIP_TEST_VERSION(Options::server_version().to_string(), #version) \

tests/src/integration/options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ std::string Options::public_key_ = "public.key";
4848
std::string Options::private_key_ = "private.key";
4949
bool Options::is_verbose_ccm_ = false;
5050
bool Options::is_verbose_integration_ = false;
51-
bool Options::is_beta_protocol_ = true;
51+
bool Options::is_beta_protocol_ = false;
5252

5353
// Static initialization is not guaranteed for the following types
5454
CCM::DseCredentialsType Options::dse_credentials_type_;

tests/src/integration/tests/test_null_string_params.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ CASSANDRA_INTEGRATION_TEST_F(SchemaNullStringApiArgsTest, FunctionAndAggregateMe
321321
CHECK_VERSION(2.2.0);
322322
// C* 3.x annotate collection columns as frozen.
323323
const CassFunctionMeta* function_meta =
324-
(schema_meta_.version().major_version == 3)
324+
(schema_meta_.version().major_version >= 3)
325325
? cass_keyspace_meta_function_by_name(keyspace_meta_.get(), "avg_final",
326326
"frozen<tuple<int,bigint>>")
327327
: cass_keyspace_meta_function_by_name(keyspace_meta_.get(), "avg_final",

tests/src/integration/tests/test_set_keyspace.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, QueryNotSupported) {
175175
*/
176176
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, QueryWithNoSessionKeyspace) {
177177
CHECK_FAILURE;
178-
CHECK_VERSION(4.0.0);
178+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
179179

180180
query_with_keyspace("");
181181
}
@@ -188,7 +188,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, QueryWithNoSessionKeyspace) {
188188
*/
189189
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, QueryWithDifferentSessionKeyspace) {
190190
CHECK_FAILURE;
191-
CHECK_VERSION(4.0.0);
191+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
192192

193193
query_with_keyspace(keyspace_name_other());
194194
}
@@ -201,7 +201,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, QueryWithDifferentSessionKeyspace
201201
*/
202202
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, QueryWithSameSessionKeyspace) {
203203
CHECK_FAILURE;
204-
CHECK_VERSION(4.0.0);
204+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
205205

206206
query_with_keyspace(keyspace_name());
207207
}
@@ -236,7 +236,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, PreparedNotSupported) {
236236
*/
237237
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, ReprepareWithSameKeyspace) {
238238
CHECK_FAILURE;
239-
CHECK_VERSION(4.0.0);
239+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
240240

241241
Session session = default_cluster().connect();
242242

@@ -265,7 +265,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, ReprepareWithSameKeyspace) {
265265
*/
266266
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, PreparedWithNoSessionKeyspace) {
267267
CHECK_FAILURE;
268-
CHECK_VERSION(4.0.0);
268+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
269269

270270
prepared_query_with_keyspace("");
271271
}
@@ -278,7 +278,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, PreparedWithNoSessionKeyspace) {
278278
*/
279279
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, PreparedWithDifferentSessionKeyspace) {
280280
CHECK_FAILURE;
281-
CHECK_VERSION(4.0.0);
281+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
282282

283283
prepared_query_with_keyspace(keyspace_name_other());
284284
}
@@ -291,7 +291,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, PreparedWithDifferentSessionKeysp
291291
*/
292292
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, PreparedWithSameSessionKeyspace) {
293293
CHECK_FAILURE;
294-
CHECK_VERSION(4.0.0);
294+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
295295

296296
prepared_query_with_keyspace(keyspace_name());
297297
}
@@ -306,7 +306,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, PreparedWithSameSessionKeyspace)
306306
*/
307307
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, BatchWithKeyspaceFromSimple) {
308308
CHECK_FAILURE;
309-
CHECK_VERSION(4.0.0);
309+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
310310

311311
Session session = default_cluster().connect();
312312

@@ -333,7 +333,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, BatchWithKeyspaceFromSimple) {
333333
*/
334334
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, BatchWithKeyspaceFromPrepared) {
335335
CHECK_FAILURE;
336-
CHECK_VERSION(4.0.0);
336+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
337337

338338
Session session = default_cluster().connect();
339339

@@ -377,7 +377,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, BatchNotSupported) {
377377
*/
378378
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, BatchWithNoSessionKeyspace) {
379379
CHECK_FAILURE;
380-
CHECK_VERSION(4.0.0);
380+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
381381

382382
batch_query_with_keyspace("");
383383
}
@@ -390,7 +390,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, BatchWithNoSessionKeyspace) {
390390
*/
391391
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, BatchWithDifferentSessionKeyspace) {
392392
CHECK_FAILURE;
393-
CHECK_VERSION(4.0.0);
393+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
394394

395395
batch_query_with_keyspace(keyspace_name_other());
396396
}
@@ -403,7 +403,7 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, BatchWithDifferentSessionKeyspace
403403
*/
404404
CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, BatchWithSameSessionKeyspace) {
405405
CHECK_FAILURE;
406-
CHECK_VERSION(4.0.0);
406+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
407407

408408
batch_query_with_keyspace(keyspace_name());
409409
}

0 commit comments

Comments
 (0)