Skip to content

Commit 0e85e1c

Browse files
committed
add additional tests to cover with_state cases
1 parent 4ed215c commit 0e85e1c

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

ballista/client/tests/common/mod.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use ballista_core::serde::{
2525
};
2626
use ballista_core::{ConfigProducer, RuntimeProducer};
2727
use ballista_scheduler::SessionBuilder;
28-
use datafusion::execution::SessionState;
28+
use datafusion::execution::{SessionState, SessionStateBuilder};
2929
use datafusion::prelude::{SessionConfig, SessionContext};
3030

3131
/// Returns the parquet test data directory, which is by default
@@ -234,6 +234,21 @@ pub async fn remote_context() -> SessionContext {
234234
.unwrap()
235235
}
236236

237+
#[allow(dead_code)]
238+
pub async fn standalone_context_with_state() -> SessionContext {
239+
let state = SessionStateBuilder::new().with_default_features().build();
240+
SessionContext::standalone_with_state(state).await.unwrap()
241+
}
242+
243+
#[allow(dead_code)]
244+
pub async fn remote_context_with_state() -> SessionContext {
245+
let state = SessionStateBuilder::new().with_default_features().build();
246+
let (host, port) = setup_test_cluster_with_state(state.clone()).await;
247+
SessionContext::remote_with_state(&format!("df://{host}:{port}"), state)
248+
.await
249+
.unwrap()
250+
}
251+
237252
#[ctor::ctor]
238253
fn init() {
239254
// Enable RUST_LOG logging configuration for test

ballista/client/tests/context_checks.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ mod common;
1919
#[cfg(test)]
2020
mod supported {
2121

22-
use crate::common::{remote_context, standalone_context};
22+
use crate::common::{
23+
remote_context, remote_context_with_state, standalone_context,
24+
standalone_context_with_state,
25+
};
2326
use ballista_core::config::BallistaConfig;
2427
use datafusion::prelude::*;
2528
use datafusion::{assert_batches_eq, prelude::SessionContext};
@@ -499,6 +502,8 @@ mod supported {
499502
#[rstest]
500503
#[case::standalone(standalone_context())]
501504
#[case::remote(remote_context())]
505+
#[case::standalone_state(standalone_context_with_state())]
506+
#[case::remote_state(remote_context_with_state())]
502507
#[tokio::test]
503508
#[cfg(not(windows))] // test is failing at windows, can't debug it
504509
async fn should_execute_sql_write_read_roundtrip(
@@ -587,6 +592,8 @@ mod supported {
587592
#[rstest]
588593
#[case::standalone(standalone_context())]
589594
#[case::remote(remote_context())]
595+
#[case::standalone_state(standalone_context_with_state())]
596+
#[case::remote_state(remote_context_with_state())]
590597
#[tokio::test]
591598
async fn should_execute_sql_show_multiple_times(
592599
#[future(awt)]

0 commit comments

Comments
 (0)