-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(query_result): cluster state tests
Added tests around query response metadata: 1. initial test for cluster state (node addresses) 2. improved trace_info test with more detailed verification based on: com.datastax.oss.driver.core.metadata.MetadataIT com.datastax.oss.driver.core.cql.QueryTraceIT
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use std::env; | ||
|
||
use hashbrown::HashSet; | ||
|
||
use crate::utils::{create_new_session_builder, setup_tracing}; | ||
|
||
#[tokio::test] | ||
#[ntest::timeout(60000)] | ||
#[cfg(not(scylla_cloud_tests))] | ||
async fn test_session_should_have_metadata() { | ||
setup_tracing(); | ||
let session = create_new_session_builder().build().await.unwrap(); | ||
let state = session.get_cluster_state(); | ||
let keys = ["SCYLLA_URI", "SCYLLA_URI2", "SCYLLA_URI3"]; | ||
let expected_addresses: HashSet<String> = keys | ||
.iter() | ||
.map(|key| env::var(key).unwrap_or_else(|_| panic!("{} not set", key))) | ||
.collect(); | ||
|
||
let got_addresses: HashSet<String> = state | ||
.get_nodes_info() | ||
.iter() | ||
.map(|node| node.address.to_string()) | ||
.collect(); | ||
|
||
assert_eq!( | ||
got_addresses, expected_addresses, | ||
"Cluster node addresses do not match environment variables" | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
mod authenticate; | ||
mod batch; | ||
mod cluster_state_tests; | ||
mod consistency; | ||
mod cql_collections; | ||
mod cql_types; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters