Skip to content

Commit

Permalink
default policy: Move some tests to integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorak-mmk committed Nov 4, 2024
1 parent 13708ba commit 759940c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
25 changes: 1 addition & 24 deletions scylla/src/transport/load_balancing/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3126,7 +3126,7 @@ mod latency_awareness {
use crate::{
load_balancing::default::NodeLocationPreference,
routing::Shard,
test_utils::{create_new_session_builder, setup_tracing},
test_utils::setup_tracing,
transport::locator::test::{TABLE_INVALID, TABLE_NTS_RF_2, TABLE_NTS_RF_3},
};
use crate::{
Expand All @@ -3139,7 +3139,6 @@ mod latency_awareness {
locator::test::{id_to_invalid_addr, A, B, C, D, E, F, G},
ClusterData, NodeAddr,
},
ExecutionProfile,
};
use tokio::time::Instant;

Expand Down Expand Up @@ -3845,28 +3844,6 @@ mod latency_awareness {
}
}

// This is a regression test for #696.
#[tokio::test]
#[ntest::timeout(1000)]
async fn latency_aware_query_completes() {
setup_tracing();
let policy = DefaultPolicy::builder()
.latency_awareness(LatencyAwarenessBuilder::default())
.build();
let handle = ExecutionProfile::builder()
.load_balancing_policy(policy)
.build()
.into_handle();

let session = create_new_session_builder()
.default_execution_profile_handle(handle)
.build()
.await
.unwrap();

session.query_unpaged("whatever", ()).await.unwrap_err();
}

#[tokio::test(start_paused = true)]
async fn timestamped_average_works_when_clock_stops() {
setup_tracing();
Expand Down
26 changes: 26 additions & 0 deletions scylla/tests/integration/default_policy.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use scylla::load_balancing::{DefaultPolicy, LatencyAwarenessBuilder};
use scylla::ExecutionProfile;

use crate::utils::{create_new_session_builder, setup_tracing};

// This is a regression test for #696.
#[tokio::test]
#[ntest::timeout(1000)]
async fn latency_aware_query_completes() {
setup_tracing();
let policy = DefaultPolicy::builder()
.latency_awareness(LatencyAwarenessBuilder::default())
.build();
let handle = ExecutionProfile::builder()
.load_balancing_policy(policy)
.build()
.into_handle();

let session = create_new_session_builder()
.default_execution_profile_handle(handle)
.build()
.await
.unwrap();

session.query_unpaged("whatever", ()).await.unwrap_err();
}
1 change: 1 addition & 0 deletions scylla/tests/integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mod consistency;
mod cql_collections;
mod cql_types;
mod cql_value;
mod default_policy;
mod execution_profiles;
mod history;
mod hygiene;
Expand Down

0 comments on commit 759940c

Please sign in to comment.