-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return Query Error for non existent DC #825
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ use crate as scylla; | |
use crate::batch::{Batch, BatchStatement}; | ||
use crate::frame::response::result::Row; | ||
use crate::frame::value::ValueList; | ||
use crate::load_balancing::DefaultPolicy; | ||
use crate::prepared_statement::PreparedStatement; | ||
use crate::query::Query; | ||
use crate::retry_policy::{QueryInfo, RetryDecision, RetryPolicy, RetrySession}; | ||
|
@@ -2857,3 +2858,33 @@ async fn test_manual_primary_key_computation() { | |
.await; | ||
} | ||
} | ||
|
||
#[tokio::test] | ||
async fn test_non_existent_dc_return_correct_error() { | ||
let ks = "iot"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, please use |
||
|
||
let host = "127.0.0.1"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tests fail because they run Scylla on different IP. Please take a look at other tests in this file - they use
on resulting builder. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks |
||
let dc = "non existent dc"; | ||
|
||
let default_policy = DefaultPolicy::builder() | ||
.prefer_datacenter(dc.to_string()) | ||
.build(); | ||
|
||
let profile = ExecutionProfile::builder() | ||
.load_balancing_policy(default_policy) | ||
.build(); | ||
|
||
let handle = profile.into_handle(); | ||
|
||
let session: Session = SessionBuilder::new() | ||
.known_node(host) | ||
.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 query_result = session.query(ks_stmt, &[]).await; | ||
|
||
assert_matches!(query_result.unwrap_err(), QueryError::EmptyQueryPlan) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanted to do a peekable check to ensure the iterator is not empty like:
but it caused this lifetime error: