From 533c7a9633435d792b432281149b685a1e4e4138 Mon Sep 17 00:00:00 2001 From: zipg Date: Wed, 19 Aug 2026 10:00:25 +0800 Subject: [PATCH] test(rust): prevent export test stack overflow --- .../tests/database_export_prefetch.rs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/crates/dbx-core/tests/database_export_prefetch.rs b/crates/dbx-core/tests/database_export_prefetch.rs index 099eb1ba5d..c02bbf3fa9 100644 --- a/crates/dbx-core/tests/database_export_prefetch.rs +++ b/crates/dbx-core/tests/database_export_prefetch.rs @@ -143,8 +143,25 @@ fn postgres_test_config(id: &str, port: u16) -> ConnectionConfig { } } -#[tokio::test] -async fn database_export_writes_structure_and_data_for_all_tables() { +#[test] +fn database_export_writes_structure_and_data_for_all_tables() { + let handle = std::thread::Builder::new() + .name("database-export-prefetch".to_string()) + .stack_size(8 * 1024 * 1024) + .spawn(|| { + tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .expect("build database export prefetch test runtime") + .block_on(run_database_export_writes_structure_and_data_for_all_tables()); + }) + .expect("spawn database export prefetch test thread"); + if let Err(panic) = handle.join() { + std::panic::resume_unwind(panic); + } +} + +async fn run_database_export_writes_structure_and_data_for_all_tables() { let Some(container) = start_docker_postgres() else { return; };