test(gateway): run wallet usage settlement test on larger stack

Wrap the wallet settlement usage test with the large-stack async test helper to
avoid stack overflow in the default test thread.
This commit is contained in:
AAEE86
2026-06-01 22:40:22 +08:00
parent b052f40ffb
commit 0e6fc96eb1
+30 -2
View File
@@ -11,8 +11,36 @@ use super::{
};
use aether_data::repository::settlement::InMemorySettlementRepository;
#[tokio::test]
async fn gateway_settles_wallet_for_completed_execution_runtime_sync_usage() {
fn run_async_test_on_large_stack<F>(name: &'static str, future: F)
where
F: std::future::Future<Output = ()> + Send + 'static,
{
let handle = std::thread::Builder::new()
.name(name.to_string())
.stack_size(8 * 1024 * 1024)
.spawn(move || {
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("tokio runtime should build")
.block_on(future);
})
.expect("large-stack test thread should spawn");
if let Err(payload) = handle.join() {
std::panic::resume_unwind(payload);
}
}
#[test]
fn gateway_settles_wallet_for_completed_execution_runtime_sync_usage() {
run_async_test_on_large_stack(
"gateway_settles_wallet_for_completed_execution_runtime_sync_usage",
gateway_settles_wallet_for_completed_execution_runtime_sync_usage_impl(),
);
}
async fn gateway_settles_wallet_for_completed_execution_runtime_sync_usage_impl() {
let usage_repository = Arc::new(InMemoryUsageReadRepository::default());
let request_candidate_repository = Arc::new(InMemoryRequestCandidateRepository::default());
let billing_repository = Arc::new(InMemoryBillingReadRepository::seed(vec![