Skip to content

Commit 4749674

Browse files
committed
integration: enable DCExecutionProfileTest_DCAware test
The test DCExecutionProfileTest.DCAware was disabled because it expected deterministic behaviour of the token-unaware round robin load balancing. As the Rust Driver round-robins nodes with a random shift, the test would fail. I reworked it to check that the node in the other DC is not used, instead of expecting a specific node in the local DC to be used. The test is now enabled in the Makefile.
1 parent 2e01bcd commit 4749674

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ SCYLLA_TEST_FILTER := $(subst ${SPACE},${EMPTY},ClusterTests.*\
4646
:ExecutionProfileTest.Integration_Cassandra_RoundRobin\
4747
:ExecutionProfileTest.Integration_Cassandra_TokenAwareRouting\
4848
:ExecutionProfileTest.Integration_Cassandra_SpeculativeExecutionPolicy\
49-
:DCExecutionProfileTest.Integration_Cassandra_DCAware\
5049
:ControlConnectionTests.Integration_Cassandra_TopologyChange\
5150
:ControlConnectionTests.Integration_Cassandra_FullOutage\
5251
:ControlConnectionTests.Integration_Cassandra_TerminatedUsingMultipleIoThreadsWithError\

tests/src/integration/tests/test_exec_profile.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -715,35 +715,31 @@ CASSANDRA_INTEGRATION_TEST_F(ExecutionProfileTest, SpeculativeExecutionPolicy) {
715715
CASSANDRA_INTEGRATION_TEST_F(DCExecutionProfileTest, DCAware) {
716716
CHECK_FAILURE;
717717

718+
// Determine the disallowed IP address for the statement DC-aware execution
719+
int const unexpected_node = 3; // The node in DC2.
720+
std::stringstream unexpected_ip_address;
721+
unexpected_ip_address << ccm_->get_ip_prefix() << unexpected_node;
722+
718723
// Execute statements over all the nodes in the cluster twice
719724
for (size_t i = 0; i < total_nodes_ * 2; ++i) {
720725
// Execute the same query with the cluster default profile
721726
insert_.set_execution_profile(""); // Reset the insert statement
722727
Result result = session_.execute(insert_);
723728
ASSERT_EQ(CASS_OK, result.error_code());
724729

725-
// Determine the expected IP address for the statement execution
726-
int expected_node = ((i * 2) % number_dc1_nodes_) + 1;
727-
std::stringstream expected_ip_address;
728-
expected_ip_address << ccm_->get_ip_prefix() << expected_node;
729-
730730
// Execute a batched query with assigned profile
731731
Batch batch;
732732
batch.add(insert_);
733733
batch.set_execution_profile("dc_aware");
734734
result = session_.execute(batch);
735735
ASSERT_EQ(CASS_OK, result.error_code());
736-
ASSERT_STREQ(expected_ip_address.str().c_str(), result.host().c_str());
737-
738-
// Increment the expected round robin IP address
739-
expected_ip_address.str("");
740-
expected_ip_address << ccm_->get_ip_prefix() << expected_node + 1;
736+
ASSERT_STRNE(unexpected_ip_address.str().c_str(), result.host().c_str());
741737

742738
// Execute a simple query with assigned profile
743739
insert_.set_execution_profile("dc_aware");
744740
result = session_.execute(insert_);
745741
ASSERT_EQ(CASS_OK, result.error_code());
746-
ASSERT_STREQ(expected_ip_address.str().c_str(), result.host().c_str());
742+
ASSERT_STRNE(unexpected_ip_address.str().c_str(), result.host().c_str());
747743
}
748744
}
749745

0 commit comments

Comments
 (0)