Skip to content

Commit 433dc5b

Browse files
authored
Merge pull request #325 from wprzytula/enable-more-tests
IT: Enable more tests
2 parents 32c75e8 + 33f6baf commit 433dc5b

File tree

4 files changed

+29
-19
lines changed

4 files changed

+29
-19
lines changed

Makefile

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,9 @@ SCYLLA_TEST_FILTER := $(subst ${SPACE},${EMPTY},ClusterTests.*\
3535
:ExecutionProfileTest.*\
3636
:DCExecutionProfileTest.*\
3737
:DisconnectedNullStringApiArgsTest.*\
38-
:MetricsTests.Integration_Cassandra_ErrorsRequestTimeouts\
39-
:MetricsTests.Integration_Cassandra_Requests\
40-
:MetricsTests.Integration_Cassandra_StatsShardConnections\
38+
:MetricsTests.*\
4139
:DcAwarePolicyTest.*\
42-
:-PreparedTests.Integration_Cassandra_PreparedIDUnchangedDuringReprepare\
43-
:SchemaMetadataTest.Integration_Cassandra_RegularMetadataNotMarkedVirtual\
40+
:-SchemaMetadataTest.Integration_Cassandra_RegularMetadataNotMarkedVirtual\
4441
:SchemaMetadataTest.Integration_Cassandra_VirtualMetadata\
4542
:HeartbeatTests.Integration_Cassandra_HeartbeatFailed\
4643
:TimestampTests.Integration_Cassandra_MonotonicTimestampGenerator\
@@ -52,9 +49,10 @@ SCYLLA_TEST_FILTER := $(subst ${SPACE},${EMPTY},ClusterTests.*\
5249
:ControlConnectionTests.Integration_Cassandra_TerminatedUsingMultipleIoThreadsWithError\
5350
:ServerSideFailureTests.Integration_Cassandra_ErrorFunctionFailure\
5451
:ServerSideFailureTests.Integration_Cassandra_ErrorFunctionAlreadyExists\
52+
:MetricsTests.Integration_Cassandra_StatsConnections\
53+
:MetricsTests.Integration_Cassandra_SpeculativeExecutionRequests\
5554
:*NoCompactEnabledConnection\
56-
:PreparedMetadataTests.Integration_Cassandra_AlterProperlyUpdatesColumnCount\
57-
:UseKeyspaceCaseSensitiveTests.Integration_Cassandra_ConnectWithKeyspace)
55+
:PreparedMetadataTests.Integration_Cassandra_AlterProperlyUpdatesColumnCount)
5856
endif
5957

6058
ifndef SCYLLA_NO_VALGRIND_TEST_FILTER
@@ -95,12 +93,9 @@ CASSANDRA_TEST_FILTER := $(subst ${SPACE},${EMPTY},ClusterTests.*\
9593
:ExecutionProfileTest.*\
9694
:DCExecutionProfileTest.*\
9795
:DisconnectedNullStringApiArgsTest.*\
98-
:MetricsTests.Integration_Cassandra_ErrorsRequestTimeouts\
99-
:MetricsTests.Integration_Cassandra_Requests\
100-
:MetricsTests.Integration_Cassandra_StatsShardConnections\
96+
:MetricsTests.*\
10197
:DcAwarePolicyTest.*\
102-
:-PreparedTests.Integration_Cassandra_PreparedIDUnchangedDuringReprepare\
103-
:PreparedTests.Integration_Cassandra_FailFastWhenPreparedIDChangesDuringReprepare\
98+
:-PreparedTests.Integration_Cassandra_FailFastWhenPreparedIDChangesDuringReprepare\
10499
:SchemaMetadataTest.Integration_Cassandra_RegularMetadataNotMarkedVirtual\
105100
:SchemaMetadataTest.Integration_Cassandra_VirtualMetadata\
106101
:HeartbeatTests.Integration_Cassandra_HeartbeatFailed\
@@ -114,9 +109,10 @@ CASSANDRA_TEST_FILTER := $(subst ${SPACE},${EMPTY},ClusterTests.*\
114109
:ServerSideFailureTests.Integration_Cassandra_ErrorFunctionFailure\
115110
:ServerSideFailureTests.Integration_Cassandra_ErrorFunctionAlreadyExists\
116111
:SslTests.Integration_Cassandra_ReconnectAfterClusterCrashAndRestart\
112+
:MetricsTests.Integration_Cassandra_StatsConnections\
113+
:MetricsTests.Integration_Cassandra_SpeculativeExecutionRequests\
117114
:*NoCompactEnabledConnection\
118-
:PreparedMetadataTests.Integration_Cassandra_AlterProperlyUpdatesColumnCount\
119-
:UseKeyspaceCaseSensitiveTests.Integration_Cassandra_ConnectWithKeyspace)
115+
:PreparedMetadataTests.Integration_Cassandra_AlterProperlyUpdatesColumnCount)
120116
endif
121117

122118
ifndef CASSANDRA_NO_VALGRIND_TEST_FILTER

scylla-rust-wrapper/src/session.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,21 @@ impl CassSessionInner {
129129
exec_profile_map.insert(name, builder.build(&default_profile).await.into_handle());
130130
}
131131

132-
if let Some(keyspace) = keyspace {
133-
session_builder = session_builder.use_keyspace(keyspace, false);
132+
if let Some(maybe_quoted_keyspace) = keyspace {
133+
// Handle case-sensitivity. If the keyspace name is enclosed in quotes, it is case-sensitive.
134+
let (unquoted_keyspace, case_sensitive) =
135+
if maybe_quoted_keyspace.starts_with('"') && maybe_quoted_keyspace.ends_with('"') {
136+
// Keyspace is case-sensitive. We acknowledge that and remove the quotes,
137+
// as the Rust Driver expects keyspace name without quotes and rejects non-alphanumeric characters.
138+
let mut quoted_keyspace = maybe_quoted_keyspace;
139+
quoted_keyspace.remove(0); // Remove the first quote.
140+
quoted_keyspace.pop(); // Remove the last quote.
141+
(quoted_keyspace, true)
142+
} else {
143+
(maybe_quoted_keyspace, false)
144+
};
145+
146+
session_builder = session_builder.use_keyspace(unquoted_keyspace, case_sensitive);
134147
}
135148

136149
let session = session_builder

tests/src/integration/objects/session.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ class Session : public Object<CassSession, cass_session_free> {
286286
session.connect_future_.wait(false);
287287
if (assert_ok && session.connect_error_code() != CASS_OK) {
288288
throw Exception("Unable to Establish Session Connection: " +
289-
session.connect_error_description(),
289+
session.connect_error_description() + " - " + session.connect_error_message(),
290290
session.connect_error_code(), session.connect_error_message());
291291
}
292292
return session;

tests/src/integration/tests/test_prepared.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ CASSANDRA_INTEGRATION_TEST_F(PreparedTests, FailFastWhenPreparedIDChangesDuringR
6262
table_name_.c_str(), "int", "int"));
6363

6464
// Execute the insert statement and validate the error code
65-
logger_.add_critera("ID mismatch while trying to prepare query");
65+
logger_.add_critera("Prepared statement id changed after repreparation");
6666
Statement insert_statement = insert_prepared.bind();
6767
insert_statement.bind<Integer>(0, Integer(0));
6868
insert_statement.bind<Integer>(1, Integer(1));
6969
Result result = session_.execute(insert_statement, false);
7070
EXPECT_TRUE(contains(result.error_message(), "Prepared statement id changed after repreparation"));
71+
EXPECT_EQ(1u, logger_.count());
7172
}
7273

7374
/**
@@ -100,7 +101,7 @@ CASSANDRA_INTEGRATION_TEST_F(PreparedTests, PreparedIDUnchangedDuringReprepare)
100101
format_string(CASSANDRA_KEY_VALUE_TABLE_FORMAT, table_name_.c_str(), "int", "int"));
101102

102103
// Execute the insert statement and validate success
103-
logger_.add_critera("Prepared query with ID");
104+
logger_.add_critera("repreparing statement with id");
104105
Statement insert_statement = insert_prepared.bind();
105106
insert_statement.bind<Integer>(0, Integer(0));
106107
insert_statement.bind<Integer>(1, Integer(1));

0 commit comments

Comments
 (0)