Skip to content

CPP-967 PreparedTests.Integration_Cassandra_FailFastWhenPreparedIDChangesDuringReprepare fails with some versions of Cassandra #549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions tests/src/integration/integration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@
return; \
}

#define SKIP_TEST_VERSION(server_version_string, version_string) \
SKIP_TEST("Unsupported for Apache Cassandra Version " \
<< server_version_string << ": Server version " << version_string << "+ is required")
#define SKIP_TEST_MESSAGE(server_version_string, comparison, version_string) \
"Unsupported for Apache Cassandra Version " << server_version_string << ": Server version is " \
<< comparison << " the specified version " << version_string

/* Maintain existing behaviour; default message indicates server < specified */
#define SKIP_TEST_VERSION(server_version_string, version_string) \
SKIP_TEST(SKIP_TEST_MESSAGE(server_version_string, '<', version_string))

#define CHECK_VERSION(version) \
do { \
Expand All @@ -94,6 +98,35 @@
} \
} while (0)

/* CPP-967 Skip test iff server version matches major.minor of specified version but
patch version is >= the specified patch level of the specified version. This
enables the concise expression of a single constraint based on multiple Cassandra
server versions.

Also note that the sense of the comaprison is inverted from what we get in
CHECK_VERSION. There we want to make sure we have a version greater than what's
specified in the constraint. Here we want to make sure we have something less than
what's specified (since the behaviour under test is fixed in later versions of
Cassandra) */
#define CHECK_VERSIONS(version_string) \
do { \
CCM::CassVersion cass_version = this->server_version_; \
if (!Options::is_cassandra()) { \
cass_version = static_cast<CCM::DseVersion>(cass_version).get_cass_version(); \
} \
std::vector<std::string> versions = Utils::explode(version_string,','); \
for (unsigned int i = 0; i < versions.size(); i++) { \
CCM::CassVersion version = CCM::CassVersion(versions[i]); \
if (cass_version.major_version == version.major_version && \
cass_version.minor_version == version.minor_version && \
cass_version.patch_version >= version.patch_version) { \
SKIP_TEST( \
SKIP_TEST_MESSAGE( \
cass_version.to_string(), ">=", version.to_string())) \
} \
} \
} while (0)

#define CHECK_PROTOCOL_VERSION(version) \
do { \
int proto_version = this->protocol_version_; \
Expand Down
1 change: 1 addition & 0 deletions tests/src/integration/tests/test_prepared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class PreparedTests : public Integration {
*/
CASSANDRA_INTEGRATION_TEST_F(PreparedTests, FailFastWhenPreparedIDChangesDuringReprepare) {
CHECK_FAILURE;
CHECK_VERSIONS("4.0.2,3.11.12,3.0.26");

// Create the table and initial prepared statement
session_.execute(format_string(CASSANDRA_KEY_VALUE_QUALIFIED_TABLE_FORMAT, keyspace_name_.c_str(),
Expand Down