Skip to content

Commit 6a806a7

Browse files
authored
Merge pull request #186 from muzarski/fix-serial-consistency-tests
integration: fix SerialConsistencyTests
2 parents fabf284 + 4c7af17 commit 6a806a7

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SCYLLA_TEST_FILTER := $(subst ${SPACE},${EMPTY},ClusterTests.*\
77
:ConfigTests.*\
88
:ConsistencyTwoNodeClusterTests.*\
99
:ConsistencyThreeNodeClusterTests.*\
10+
:SerialConsistencyTests.*\
1011
:PreparedTests.*\
1112
:CassandraTypes/CassandraTypesTests/*.Integration_Cassandra_*\
1213
:BatchSingleNodeClusterTests*:BatchCounterSingleNodeClusterTests*:BatchCounterThreeNodeClusterTests*\
@@ -32,6 +33,7 @@ CASSANDRA_TEST_FILTER := $(subst ${SPACE},${EMPTY},ClusterTests.*\
3233
:ConfigTests.*\
3334
:ConsistencyTwoNodeClusterTests.*\
3435
:ConsistencyThreeNodeClusterTests.*\
36+
:SerialConsistencyTests.*\
3537
:PreparedTests.*\
3638
:CassandraTypes/CassandraTypesTests/*.Integration_Cassandra_*\
3739
:ErrorTests.*\

tests/src/integration/tests/test_consistency.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17+
#include "cassandra.h"
1718
#include "integration.hpp"
1819
#include "options.hpp"
1920

@@ -425,6 +426,17 @@ CASSANDRA_INTEGRATION_TEST_F(SerialConsistencyTests, Simple) {
425426
CASSANDRA_INTEGRATION_TEST_F(SerialConsistencyTests, Invalid) {
426427
CHECK_FAILURE;
427428

428-
Result result = insert_if_not_exists(CASS_CONSISTENCY_ONE); // Invalid serial consistency
429-
EXPECT_EQ(CASS_ERROR_SERVER_INVALID_QUERY, result.error_code());
429+
// Original cpp-driver allows user to SET the invalid serial consistency.
430+
// Then, the request is sent with an invalid serial consistency, resulting in a server error.
431+
// However, rust-driver comes with a type safety in this matter, disallowing
432+
// the user to set invalid serial consistency, thus we are not able to mimic this behaviour in cpp-rust-driver.
433+
// We need to adjust this test, and assert that setting the invalid serial consistency fails with an error.
434+
// Original test case logic:
435+
//// Result result = insert_if_not_exists(CASS_CONSISTENCY_ONE); // Invalid serial consistency
436+
//// EXPECT_EQ(CASS_ERROR_SERVER_INVALID_QUERY, result.error_code());
437+
438+
Statement statement(format_string("INSERT INTO %s (key, value) VALUES (1, 99) IF NOT EXISTS",
439+
table_name_.c_str()));
440+
CassError result = cass_statement_set_serial_consistency(statement.get(), CASS_CONSISTENCY_ONE);
441+
ASSERT_EQ(CASS_ERROR_LIB_BAD_PARAMS, result);
430442
}

0 commit comments

Comments
 (0)