Skip to content

Commit 292efe9

Browse files
authored
CPP-966 Compilation warnings after cass_set_use_hostname_resolution() marked as deprecated (#551)
* Change ccm updateconf logic to not enable MV and UDF in the DSE case. Necessary to get newer versions of DSE running for tests. * Remove the offending function from the (test) cluster building logic as well as any callers * Remove beta protocol support from CLI options exposed via the integration tests * Remove beta protocol support from test cluster object as well * A drive-by fix: make the error messages for protocol version vs. server version distinct in order to avoid confusion
1 parent 6bda881 commit 292efe9

11 files changed

+20
-82
lines changed

tests/src/integration/ccm/bridge.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ 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") {
1494+
if (cassandra_version >= "4.0.0" && !is_dse()) {
14951495
updateconf_command.push_back("enable_materialized_views:true");
14961496
updateconf_command.push_back("enable_user_defined_functions:true");
14971497
}

tests/src/integration/integration.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ Integration::Integration()
6565
, is_session_requested_(true)
6666
, is_keyspace_change_requested_(true)
6767
, is_test_chaotic_(false)
68-
, is_beta_protocol_(Options::is_beta_protocol())
6968
, protocol_version_(CASS_PROTOCOL_VERSION_V4)
7069
, create_keyspace_query_("")
7170
, start_time_(0ull) {

tests/src/integration/integration.hpp

+16-17
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,17 @@
7979
return; \
8080
}
8181

82-
#define SKIP_TEST_MESSAGE(server_version_string, comparison, version_string) \
82+
#define SERVER_VERSION_SKIP_TEST_MESSAGE(server_version_string, comparison, version_string) \
8383
"Unsupported for Apache Cassandra Version " << server_version_string << ": Server version is " \
8484
<< comparison << " the specified version " << version_string
8585

86+
#define PROTOCOL_VERSION_SKIP_TEST_MESSAGE(server_version_string, comparison, version_string) \
87+
"Unsupported for Apache Cassandra protocol version " << server_version_string << ": Server version is " \
88+
<< comparison << " the specified protocol version " << version_string
89+
8690
/* Maintain existing behaviour; default message indicates server < specified */
8791
#define SKIP_TEST_VERSION(server_version_string, version_string) \
88-
SKIP_TEST(SKIP_TEST_MESSAGE(server_version_string, '<', version_string))
92+
SKIP_TEST(SERVER_VERSION_SKIP_TEST_MESSAGE(server_version_string, '<', version_string))
8993

9094
#define CHECK_VERSION(version) \
9195
do { \
@@ -114,25 +118,27 @@
114118
if (!Options::is_cassandra()) { \
115119
cass_version = static_cast<CCM::DseVersion>(cass_version).get_cass_version(); \
116120
} \
117-
std::vector<std::string> versions = Utils::explode(version_string,','); \
121+
std::vector<std::string> versions = Utils::explode(version_string,','); \
118122
for (unsigned int i = 0; i < versions.size(); i++) { \
119123
CCM::CassVersion version = CCM::CassVersion(versions[i]); \
120124
if (cass_version.major_version == version.major_version && \
121125
cass_version.minor_version == version.minor_version && \
122126
cass_version.patch_version >= version.patch_version) { \
123127
SKIP_TEST( \
124-
SKIP_TEST_MESSAGE( \
128+
SERVER_VERSION_SKIP_TEST_MESSAGE( \
125129
cass_version.to_string(), ">=", version.to_string())) \
126130
} \
127131
} \
128132
} while (0)
129133

130-
#define CHECK_PROTOCOL_VERSION(version) \
131-
do { \
132-
int proto_version = this->protocol_version_; \
133-
if (proto_version < version) { \
134-
SKIP_TEST_VERSION(std::to_string(proto_version), #version) \
135-
} \
134+
#define CHECK_PROTOCOL_VERSION(version) \
135+
do { \
136+
int proto_version = this->protocol_version_; \
137+
if (proto_version < version) { \
138+
SKIP_TEST( \
139+
PROTOCOL_VERSION_SKIP_TEST_MESSAGE( \
140+
proto_version, '<', version)); \
141+
} \
136142
} while (0)
137143

138144
#define CHECK_OPTIONS_VERSION(version) \
@@ -343,13 +349,6 @@ class Integration : public testing::Test {
343349
* destroyed
344350
*/
345351
bool is_test_chaotic_;
346-
/**
347-
* Flag to indicate if the beta protocol should be enabled. True if beta
348-
* protocol should be enabled (Cassandra must be >= v3.10.0); false
349-
* otherwise.
350-
* (DEFAULT: true)
351-
*/
352-
bool is_beta_protocol_;
353352
/**
354353
* Workload to apply to the cluster
355354
*/

tests/src/integration/objects/cluster.hpp

-29
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,6 @@ class Cluster : public Object<CassCluster, cass_cluster_free> {
8080
return *this;
8181
}
8282

83-
/**
84-
* Use the newest beta protocol version
85-
*
86-
* @param enable True if beta protocol should be enable; false the highest
87-
* non-beta protocol will be used (unless set) (default: false)
88-
* @return Cluster object
89-
*/
90-
Cluster& with_beta_protocol(bool enable = false) {
91-
EXPECT_EQ(CASS_OK, cass_cluster_set_use_beta_protocol_version(
92-
get(), (enable == true ? cass_true : cass_false)));
93-
return *this;
94-
}
95-
9683
/**
9784
* Sets the timeout for connecting to a node
9885
*
@@ -206,22 +193,6 @@ class Cluster : public Object<CassCluster, cass_cluster_free> {
206193
return *this;
207194
}
208195

209-
/**
210-
* Enable/Disable the use of hostname resolution
211-
*
212-
* This is useful for authentication (Kerberos) or encryption (SSL)
213-
* services that require a valid hostname for verification.
214-
*
215-
* @param enable True if hostname resolution should be enabled; false
216-
* otherwise (default: true)
217-
* @return Cluster object
218-
*/
219-
Cluster& with_hostname_resolution(bool enable = true) {
220-
EXPECT_EQ(CASS_OK, cass_cluster_set_use_hostname_resolution(
221-
get(), (enable == true ? cass_true : cass_false)));
222-
return *this;
223-
}
224-
225196
/**
226197
* Sets the number of I/O threads. This is the number of threads that will
227198
* handle query requests

tests/src/integration/options.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ 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_ = false;
5251

5352
// Static initialization is not guaranteed for the following types
5453
CCM::DseCredentialsType Options::dse_credentials_type_;
@@ -185,8 +184,6 @@ bool Options::initialize(int argc, char* argv[]) {
185184
is_verbose_ccm_ = true;
186185
is_verbose_integration_ = true;
187186
}
188-
} else if (key == "--disable-beta-protocol") {
189-
is_beta_protocol_ = false;
190187
}
191188
#ifdef CASS_USE_LIBSSH2
192189
else if (key == "--authentication") {
@@ -380,11 +377,6 @@ void Options::print_help() {
380377
std::cout << " --verbose(=ccm,integration)" << std::endl
381378
<< " "
382379
<< "Enable verbose output for component(s)." << std::endl;
383-
std::cout << " --disable-beta-protocol" << std::endl
384-
<< " "
385-
<< "Disable beta protocol use by default." << std::endl
386-
<< " "
387-
<< "NOTE: Individual tests may override this setting." << std::endl;
388380
std::cout << std::endl;
389381
}
390382

@@ -522,8 +514,6 @@ bool Options::is_verbose_ccm() { return is_verbose_ccm_; }
522514

523515
bool Options::is_verbose_integration() { return is_verbose_integration_; }
524516

525-
bool Options::is_beta_protocol() { return is_beta_protocol_; }
526-
527517
Options::Options() {}
528518

529519
bool Options::bool_value(const std::string& value) {

tests/src/integration/options.hpp

-14
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,6 @@ class Options {
226226
* otherwise
227227
*/
228228
static bool is_verbose_integration();
229-
/**
230-
* Flag to determine if beta protocol should be enabled or not; should only
231-
* pertain to the default setting.
232-
*
233-
* @return True if beta protocol should be enabled; false otherwise
234-
*/
235-
static bool is_beta_protocol();
236229
/**
237230
* Get a CCM instance based on the options
238231
*
@@ -350,13 +343,6 @@ class Options {
350343
* Flag to determine if verbose integration output should enabled
351344
*/
352345
static bool is_verbose_integration_;
353-
/**
354-
* Flag to determine if beta protocol should be enabled or not; should only
355-
* pertain to the default setting.
356-
*
357-
* NOTE: Individual tests can still override this.
358-
*/
359-
static bool is_beta_protocol_;
360346

361347
/**
362348
* Hidden default constructor

tests/src/integration/tests/test_auth.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class AuthenticationTests : public Integration {
3434
// Configure and start the CCM cluster for plain text authentication usage
3535
ccm_->update_cluster_configuration("authenticator", "PasswordAuthenticator");
3636
ccm_->start_cluster("-Dcassandra.superuser_setup_delay_ms=0");
37-
cluster_ = default_cluster().with_beta_protocol(false);
37+
cluster_ = default_cluster();
3838
}
3939

4040
protected:

tests/src/integration/tests/test_dse_auth.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ class AuthenticationTest : public DseIntegration {
177177
Cluster cluster = dse::Cluster::build()
178178
.with_gssapi_authenticator("dse", principal)
179179
.with_contact_points(contact_points_)
180-
.with_hostname_resolution(true)
181180
.with_schema_metadata(false);
182181
Session session = cluster.connect();
183182

@@ -203,7 +202,6 @@ class AuthenticationTest : public DseIntegration {
203202
Cluster cluster = dse::Cluster::build()
204203
.with_plaintext_authenticator(username, password)
205204
.with_contact_points(contact_points_)
206-
.with_hostname_resolution(true)
207205
.with_schema_metadata(false);
208206
Session session = cluster.connect();
209207

tests/src/integration/tests/test_exec_profile.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class ExecutionProfileTest : public Integration {
3030
, skip_base_execution_profile_(false) {
3131
replication_factor_ = 2;
3232
number_dc1_nodes_ = 2;
33-
is_beta_protocol_ = false; // Issue with beta protocol v5 and functions on Cassandra v3.10.0+
3433
}
3534

3635
void SetUp() {

tests/src/integration/tests/test_prepared_metadata.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ CASSANDRA_INTEGRATION_TEST_F(PreparedMetadataTests, AlterDoesntUpdateColumnCount
7070

7171
// Ensure beta protocol is not set
7272
Session session = default_cluster()
73-
.with_beta_protocol(false)
7473
.with_protocol_version(CASS_PROTOCOL_VERSION_V4)
7574
.connect(keyspace_name_);
7675

@@ -87,10 +86,10 @@ CASSANDRA_INTEGRATION_TEST_F(PreparedMetadataTests, AlterDoesntUpdateColumnCount
8786
*/
8887
CASSANDRA_INTEGRATION_TEST_F(PreparedMetadataTests, AlterProperlyUpdatesColumnCount) {
8988
CHECK_FAILURE;
90-
CHECK_VERSION(4.0.0);
89+
CHECK_PROTOCOL_VERSION(CASS_PROTOCOL_VERSION_V5);
9190

9291
// Ensure protocol v5 or greater
93-
Session session = default_cluster().with_beta_protocol(true).connect(keyspace_name_);
92+
Session session = default_cluster().connect(keyspace_name_);
9493

9594
// The column count will properly update after the alter
9695
prepared_check_column_count_after_alter(session, 3u);

tests/src/integration/tests/test_set_keyspace.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, QueryNotSupported) {
156156
CHECK_FAILURE;
157157

158158
Session session = default_cluster()
159-
.with_beta_protocol(false)
160159
.with_protocol_version(CASS_PROTOCOL_VERSION_V4)
161160
.connect();
162161

@@ -216,7 +215,6 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, PreparedNotSupported) {
216215
CHECK_FAILURE;
217216

218217
Session session = default_cluster()
219-
.with_beta_protocol(false)
220218
.with_protocol_version(CASS_PROTOCOL_VERSION_V4)
221219
.connect();
222220

@@ -362,7 +360,6 @@ CASSANDRA_INTEGRATION_TEST_F(SetKeyspaceTests, BatchNotSupported) {
362360
CHECK_FAILURE;
363361

364362
Session session = default_cluster()
365-
.with_beta_protocol(false)
366363
.with_protocol_version(CASS_PROTOCOL_VERSION_V4)
367364
.connect();
368365

0 commit comments

Comments
 (0)