fix scheduler affinity candidate selection

This commit is contained in:
fawney19
2026-04-30 16:27:24 +08:00
parent 558abfcfa3
commit 33aa70c22b
24 changed files with 1715 additions and 104 deletions
@@ -23,8 +23,39 @@ use aether_data_contracts::repository::provider_catalog::{
};
use sha2::{Digest, Sha256};
#[tokio::test]
async fn gateway_executes_claude_chat_sync_same_format_via_local_finalize_response() {
const CLAUDE_PROVIDER_FINALIZE_TEST_STACK_BYTES: usize = 16 * 1024 * 1024;
fn run_claude_provider_finalize_test<F, Fut>(test_name: &'static str, make_future: F)
where
F: FnOnce() -> Fut + Send + 'static,
Fut: std::future::Future<Output = ()> + 'static,
{
let handle = std::thread::Builder::new()
.name(test_name.to_string())
.stack_size(CLAUDE_PROVIDER_FINALIZE_TEST_STACK_BYTES)
.spawn(move || {
let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("test runtime should build");
runtime.block_on(make_future());
})
.expect("claude provider finalize test thread should spawn");
if let Err(payload) = handle.join() {
std::panic::resume_unwind(payload);
}
}
#[test]
fn gateway_executes_claude_chat_sync_same_format_via_local_finalize_response() {
run_claude_provider_finalize_test(
"gateway_executes_claude_chat_sync_same_format_via_local_finalize_response",
gateway_executes_claude_chat_sync_same_format_via_local_finalize_response_impl,
);
}
async fn gateway_executes_claude_chat_sync_same_format_via_local_finalize_response_impl() {
#[derive(Debug, Clone)]
struct SeenRemoteExecutionRuntimeRequest {
trace_id: String,
@@ -468,8 +499,15 @@ async fn gateway_executes_claude_chat_sync_same_format_via_local_finalize_respon
upstream_handle.abort();
}
#[tokio::test]
async fn gateway_executes_claude_chat_sync_upstream_stream_via_local_finalize_response() {
#[test]
fn gateway_executes_claude_chat_sync_upstream_stream_via_local_finalize_response() {
run_claude_provider_finalize_test(
"gateway_executes_claude_chat_sync_upstream_stream_via_local_finalize_response",
gateway_executes_claude_chat_sync_upstream_stream_via_local_finalize_response_impl,
);
}
async fn gateway_executes_claude_chat_sync_upstream_stream_via_local_finalize_response_impl() {
use base64::Engine as _;
#[derive(Debug, Clone)]
@@ -921,8 +959,15 @@ async fn gateway_executes_claude_chat_sync_upstream_stream_via_local_finalize_re
upstream_handle.abort();
}
#[tokio::test]
async fn gateway_executes_claude_cli_sync_upstream_stream_via_local_finalize_response() {
#[test]
fn gateway_executes_claude_cli_sync_upstream_stream_via_local_finalize_response() {
run_claude_provider_finalize_test(
"gateway_executes_claude_cli_sync_upstream_stream_via_local_finalize_response",
gateway_executes_claude_cli_sync_upstream_stream_via_local_finalize_response_impl,
);
}
async fn gateway_executes_claude_cli_sync_upstream_stream_via_local_finalize_response_impl() {
use base64::Engine as _;
#[derive(Debug, Clone)]
@@ -23,8 +23,39 @@ use aether_data_contracts::repository::provider_catalog::{
};
use sha2::{Digest, Sha256};
#[tokio::test]
async fn gateway_executes_gemini_chat_sync_same_format_via_local_finalize_response() {
const GEMINI_PROVIDER_FINALIZE_TEST_STACK_BYTES: usize = 16 * 1024 * 1024;
fn run_gemini_provider_finalize_test<F, Fut>(test_name: &'static str, make_future: F)
where
F: FnOnce() -> Fut + Send + 'static,
Fut: std::future::Future<Output = ()> + 'static,
{
let handle = std::thread::Builder::new()
.name(test_name.to_string())
.stack_size(GEMINI_PROVIDER_FINALIZE_TEST_STACK_BYTES)
.spawn(move || {
let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("test runtime should build");
runtime.block_on(make_future());
})
.expect("gemini provider finalize test thread should spawn");
if let Err(payload) = handle.join() {
std::panic::resume_unwind(payload);
}
}
#[test]
fn gateway_executes_gemini_chat_sync_same_format_via_local_finalize_response() {
run_gemini_provider_finalize_test(
"gateway_executes_gemini_chat_sync_same_format_via_local_finalize_response",
gateway_executes_gemini_chat_sync_same_format_via_local_finalize_response_impl,
);
}
async fn gateway_executes_gemini_chat_sync_same_format_via_local_finalize_response_impl() {
#[derive(Debug, Clone)]
struct SeenRemoteExecutionRuntimeRequest {
trace_id: String,
@@ -517,8 +548,15 @@ async fn gateway_executes_gemini_chat_sync_same_format_via_local_finalize_respon
upstream_handle.abort();
}
#[tokio::test]
async fn gateway_executes_gemini_chat_sync_upstream_stream_via_local_finalize_response() {
#[test]
fn gateway_executes_gemini_chat_sync_upstream_stream_via_local_finalize_response() {
run_gemini_provider_finalize_test(
"gateway_executes_gemini_chat_sync_upstream_stream_via_local_finalize_response",
gateway_executes_gemini_chat_sync_upstream_stream_via_local_finalize_response_impl,
);
}
async fn gateway_executes_gemini_chat_sync_upstream_stream_via_local_finalize_response_impl() {
use base64::Engine as _;
#[derive(Debug, Clone)]
@@ -1003,8 +1041,15 @@ async fn gateway_executes_gemini_chat_sync_upstream_stream_via_local_finalize_re
upstream_handle.abort();
}
#[tokio::test]
async fn gateway_executes_gemini_cli_sync_upstream_stream_via_local_finalize_response() {
#[test]
fn gateway_executes_gemini_cli_sync_upstream_stream_via_local_finalize_response() {
run_gemini_provider_finalize_test(
"gateway_executes_gemini_cli_sync_upstream_stream_via_local_finalize_response",
gateway_executes_gemini_cli_sync_upstream_stream_via_local_finalize_response_impl,
);
}
async fn gateway_executes_gemini_cli_sync_upstream_stream_via_local_finalize_response_impl() {
use base64::Engine as _;
#[derive(Debug, Clone)]
@@ -1491,9 +1536,16 @@ async fn gateway_executes_gemini_cli_sync_upstream_stream_via_local_finalize_res
upstream_handle.abort();
}
#[tokio::test]
async fn gateway_executes_antigravity_gemini_cli_sync_upstream_stream_via_local_finalize_response()
{
#[test]
fn gateway_executes_antigravity_gemini_cli_sync_upstream_stream_via_local_finalize_response() {
run_gemini_provider_finalize_test(
"gateway_executes_antigravity_gemini_cli_sync_upstream_stream_via_local_finalize_response",
gateway_executes_antigravity_gemini_cli_sync_upstream_stream_via_local_finalize_response_impl,
);
}
async fn gateway_executes_antigravity_gemini_cli_sync_upstream_stream_via_local_finalize_response_impl(
) {
use base64::Engine as _;
#[derive(Debug, Clone)]