Skip to content

Commit

Permalink
review feedback: use unique keyspace and generic create session builder
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelorji committed Oct 19, 2023
1 parent f860086 commit 2e8f14e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions scylla/src/transport/session_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2861,11 +2861,9 @@ async fn test_manual_primary_key_computation() {

#[tokio::test]
async fn test_non_existent_dc_return_correct_error() {
let ks = "iot";
let ks = unique_keyspace_name();

let host = "127.0.0.1";
let dc = "non existent dc";

let default_policy = DefaultPolicy::builder()
.prefer_datacenter(dc.to_string())
.build();
Expand All @@ -2876,14 +2874,13 @@ async fn test_non_existent_dc_return_correct_error() {

let handle = profile.into_handle();

let session: Session = SessionBuilder::new()
.known_node(host)
let session: Session = create_new_session_builder()
.default_execution_profile_handle(handle)
.build()
.await
.expect("cannot create session");

let ks_stmt = format!("CREATE KEYSPACE IF NOT EXISTS {} WITH replication = {{'class': 'NetworkTopologyStrategy', '{}': 1}}", ks, dc);
let ks_stmt = format!("CREATE KEYSPACE IF NOT EXISTS {} WITH replication = {{'class': 'NetworkTopologyStrategy', 'replication_factor' : 1}}", ks);
let query_result = session.query(ks_stmt, &[]).await;

assert_matches!(query_result.unwrap_err(), QueryError::EmptyQueryPlan)
Expand Down

0 comments on commit 2e8f14e

Please sign in to comment.