Skip to content

Commit d0c2e66

Browse files
committed
testing: uncomment the filtering code
The filtering is now implemented. Unfortunately, we cannot enable any integration tests yet. They require cass_future_coordinator.
1 parent 09f8534 commit d0c2e66

File tree

2 files changed

+54
-58
lines changed

2 files changed

+54
-58
lines changed

tests/src/integration/objects/execution_profile.hpp

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,27 @@ class ExecutionProfile : public Object<CassExecProfile, cass_execution_profile_f
6363
*/
6464
static ExecutionProfile build() { return ExecutionProfile(); }
6565

66-
// Host filtering is not supported in cpp-rust-driver
67-
// /**
68-
// * Append/Assign/Set the blacklist hosts for statement/batch execution
69-
// *
70-
// * @param hosts A comma delimited list of hosts addresses
71-
// * @return Execution profile object
72-
// */
73-
// ExecutionProfile& with_blacklist_filtering(const std::string& hosts) {
74-
// EXPECT_EQ(CASS_OK, cass_execution_profile_set_blacklist_filtering(get(), hosts.c_str()));
75-
// return *this;
76-
// }
66+
/**
67+
* Append/Assign/Set the blacklist hosts for statement/batch execution
68+
*
69+
* @param hosts A comma delimited list of hosts addresses
70+
* @return Execution profile object
71+
*/
72+
ExecutionProfile& with_blacklist_filtering(const std::string& hosts) {
73+
EXPECT_EQ(CASS_OK, cass_execution_profile_set_blacklist_filtering(get(), hosts.c_str()));
74+
return *this;
75+
}
7776

78-
// /**
79-
// * Append/Assign/Set the blacklist data centers for statement/batch execution
80-
// *
81-
// * @param dcs A comma delimited list of data center names
82-
// * @return Execution profile object
83-
// */
84-
// ExecutionProfile& with_blacklist_dc_filtering(const std::string& dcs) {
85-
// EXPECT_EQ(CASS_OK, cass_execution_profile_set_blacklist_dc_filtering(get(), dcs.c_str()));
86-
// return *this;
87-
// }
77+
/**
78+
* Append/Assign/Set the blacklist data centers for statement/batch execution
79+
*
80+
* @param dcs A comma delimited list of data center names
81+
* @return Execution profile object
82+
*/
83+
ExecutionProfile& with_blacklist_dc_filtering(const std::string& dcs) {
84+
EXPECT_EQ(CASS_OK, cass_execution_profile_set_blacklist_dc_filtering(get(), dcs.c_str()));
85+
return *this;
86+
}
8887

8988
/**
9089
* Assign/Set the profile consistency level for statement/batch execution
@@ -258,28 +257,27 @@ class ExecutionProfile : public Object<CassExecProfile, cass_execution_profile_f
258257
return *this;
259258
}
260259

261-
// Host filtering is not supported in cpp-rust-driver
262-
// /**
263-
// * Append/Assign/Set the whitelist hosts for statement/batch execution
264-
// *
265-
// * @param hosts A comma delimited list of hosts addresses
266-
// * @return Execution profile object
267-
// */
268-
// ExecutionProfile& with_whitelist_filtering(const std::string& hosts) {
269-
// EXPECT_EQ(CASS_OK, cass_execution_profile_set_whitelist_filtering(get(), hosts.c_str()));
270-
// return *this;
271-
// }
260+
/**
261+
* Append/Assign/Set the whitelist hosts for statement/batch execution
262+
*
263+
* @param hosts A comma delimited list of hosts addresses
264+
* @return Execution profile object
265+
*/
266+
ExecutionProfile& with_whitelist_filtering(const std::string& hosts) {
267+
EXPECT_EQ(CASS_OK, cass_execution_profile_set_whitelist_filtering(get(), hosts.c_str()));
268+
return *this;
269+
}
272270

273-
// /**
274-
// * Append/Assign/Set the whitelist data centers for statement/batch execution
275-
// *
276-
// * @param dcs A comma delimited list of data center names
277-
// * @return Execution profile object
278-
// */
279-
// ExecutionProfile& with_whitelist_dc_filtering(const std::string& dcs) {
280-
// EXPECT_EQ(CASS_OK, cass_execution_profile_set_whitelist_dc_filtering(get(), dcs.c_str()));
281-
// return *this;
282-
// }
271+
/**
272+
* Append/Assign/Set the whitelist data centers for statement/batch execution
273+
*
274+
* @param dcs A comma delimited list of data center names
275+
* @return Execution profile object
276+
*/
277+
ExecutionProfile& with_whitelist_dc_filtering(const std::string& dcs) {
278+
EXPECT_EQ(CASS_OK, cass_execution_profile_set_whitelist_dc_filtering(get(), dcs.c_str()));
279+
return *this;
280+
}
283281
};
284282

285283
}} // namespace test::driver

tests/src/integration/tests/test_exec_profile.cpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ class ExecutionProfileTest : public Integration {
5353
ExecutionProfile::build().with_latency_aware_routing().with_load_balance_round_robin();
5454
profiles_["token_aware"] =
5555
ExecutionProfile::build().with_token_aware_routing().with_load_balance_round_robin();
56-
// Host filtering is not supported in cpp-rust-driver
57-
// profiles_["blacklist"] = ExecutionProfile::build()
58-
// .with_blacklist_filtering(Options::host_prefix() + "1")
59-
// .with_load_balance_round_robin();
60-
// profiles_["whitelist"] = ExecutionProfile::build()
61-
// .with_whitelist_filtering(Options::host_prefix() + "1")
62-
// .with_load_balance_round_robin();
56+
profiles_["blacklist"] = ExecutionProfile::build()
57+
.with_blacklist_filtering(Options::host_prefix() + "1")
58+
.with_load_balance_round_robin();
59+
profiles_["whitelist"] = ExecutionProfile::build()
60+
.with_whitelist_filtering(Options::host_prefix() + "1")
61+
.with_load_balance_round_robin();
6362
profiles_["retry_policy"] = ExecutionProfile::build()
6463
// We do not implement logging retry policy in cpp-rust-driver
6564
.with_retry_policy(child_retry_policy_)
@@ -197,15 +196,14 @@ class DCExecutionProfileTest : public ExecutionProfileTest {
197196
profiles_["dc_aware"] = ExecutionProfile::build()
198197
.with_load_balance_dc_aware("dc1", 1, false)
199198
.with_consistency(CASS_CONSISTENCY_LOCAL_ONE);
200-
// Host filtering is not supported in cpp-rust-driver
201-
// profiles_["blacklist_dc"] = ExecutionProfile::build()
202-
// .with_blacklist_dc_filtering("dc1")
203-
// .with_load_balance_dc_aware("dc1", 1, true)
204-
// .with_consistency(CASS_CONSISTENCY_LOCAL_ONE);
205-
// profiles_["whitelist_dc"] = ExecutionProfile::build()
206-
// .with_whitelist_dc_filtering("dc2")
207-
// .with_load_balance_dc_aware("dc1", 1, true)
208-
// .with_consistency(CASS_CONSISTENCY_LOCAL_ONE);
199+
profiles_["blacklist_dc"] = ExecutionProfile::build()
200+
.with_blacklist_dc_filtering("dc1")
201+
.with_load_balance_dc_aware("dc1", 1, true)
202+
.with_consistency(CASS_CONSISTENCY_LOCAL_ONE);
203+
profiles_["whitelist_dc"] = ExecutionProfile::build()
204+
.with_whitelist_dc_filtering("dc2")
205+
.with_load_balance_dc_aware("dc1", 1, true)
206+
.with_consistency(CASS_CONSISTENCY_LOCAL_ONE);
209207

210208
// Call the parent setup function
211209
skip_base_execution_profile_ = true;

0 commit comments

Comments
 (0)