mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 10:27:46 +08:00
Improve gateway transport and usage runtime
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use super::{
|
||||
any, build_router_with_execution_runtime_override, build_router_with_state,
|
||||
build_state_with_execution_runtime_override, json, start_server, to_bytes, Arc, Body, Bytes,
|
||||
HeaderName, HeaderValue, Json, Mutex, Request, Response, Router, StatusCode,
|
||||
CONTROL_EXECUTED_HEADER, EXECUTION_PATH_EXECUTION_RUNTIME_SYNC, EXECUTION_PATH_HEADER,
|
||||
TRACE_ID_HEADER,
|
||||
build_state_with_execution_runtime_override, json, run_finalize_local_cli_test, start_server,
|
||||
to_bytes, Arc, Body, Bytes, HeaderName, HeaderValue, Json, Mutex, Request, Response, Router,
|
||||
StatusCode, CONTROL_EXECUTED_HEADER, EXECUTION_PATH_EXECUTION_RUNTIME_SYNC,
|
||||
EXECUTION_PATH_HEADER, TRACE_ID_HEADER,
|
||||
};
|
||||
use crate::data::GatewayDataState;
|
||||
use aether_crypto::{encrypt_python_fernet_plaintext, DEVELOPMENT_ENCRYPTION_KEY};
|
||||
@@ -25,8 +25,16 @@ use aether_data_contracts::repository::provider_catalog::{
|
||||
};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
#[tokio::test]
|
||||
async fn gateway_executes_openai_responses_compact_openai_family_upstream_stream_via_local_finalize_response(
|
||||
#[test]
|
||||
fn gateway_executes_openai_responses_compact_openai_family_upstream_stream_via_local_finalize_response(
|
||||
) {
|
||||
run_finalize_local_cli_test(
|
||||
"gateway_executes_openai_responses_compact_openai_family_upstream_stream_via_local_finalize_response",
|
||||
gateway_executes_openai_responses_compact_openai_family_upstream_stream_via_local_finalize_response_impl,
|
||||
);
|
||||
}
|
||||
|
||||
async fn gateway_executes_openai_responses_compact_openai_family_upstream_stream_via_local_finalize_response_impl(
|
||||
) {
|
||||
use base64::Engine as _;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use super::{
|
||||
any, build_router_with_execution_runtime_override, build_router_with_state,
|
||||
build_state_with_execution_runtime_override, json, start_server, to_bytes, Arc, Body, Bytes,
|
||||
HeaderName, HeaderValue, Json, Mutex, Request, Response, Router, StatusCode,
|
||||
CONTROL_EXECUTED_HEADER, EXECUTION_PATH_EXECUTION_RUNTIME_SYNC, EXECUTION_PATH_HEADER,
|
||||
TRACE_ID_HEADER,
|
||||
build_state_with_execution_runtime_override, json, run_finalize_local_cli_test, start_server,
|
||||
to_bytes, Arc, Body, Bytes, HeaderName, HeaderValue, Json, Mutex, Request, Response, Router,
|
||||
StatusCode, CONTROL_EXECUTED_HEADER, EXECUTION_PATH_EXECUTION_RUNTIME_SYNC,
|
||||
EXECUTION_PATH_HEADER, TRACE_ID_HEADER,
|
||||
};
|
||||
use crate::data::GatewayDataState;
|
||||
use aether_crypto::{encrypt_python_fernet_plaintext, DEVELOPMENT_ENCRYPTION_KEY};
|
||||
@@ -25,8 +25,15 @@ use aether_data_contracts::repository::provider_catalog::{
|
||||
};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
#[tokio::test]
|
||||
async fn gateway_executes_openai_responses_cross_format_upstream_stream_via_local_finalize_response(
|
||||
#[test]
|
||||
fn gateway_executes_openai_responses_cross_format_upstream_stream_via_local_finalize_response() {
|
||||
run_finalize_local_cli_test(
|
||||
"gateway_executes_openai_responses_cross_format_upstream_stream_via_local_finalize_response",
|
||||
gateway_executes_openai_responses_cross_format_upstream_stream_via_local_finalize_response_impl,
|
||||
);
|
||||
}
|
||||
|
||||
async fn gateway_executes_openai_responses_cross_format_upstream_stream_via_local_finalize_response_impl(
|
||||
) {
|
||||
use base64::Engine as _;
|
||||
|
||||
@@ -490,8 +497,16 @@ async fn gateway_executes_openai_responses_cross_format_upstream_stream_via_loca
|
||||
upstream_handle.abort();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn gateway_executes_openai_responses_cross_format_function_call_upstream_stream_via_local_finalize_response(
|
||||
#[test]
|
||||
fn gateway_executes_openai_responses_cross_format_function_call_upstream_stream_via_local_finalize_response(
|
||||
) {
|
||||
run_finalize_local_cli_test(
|
||||
"gateway_executes_openai_responses_cross_format_function_call_upstream_stream_via_local_finalize_response",
|
||||
gateway_executes_openai_responses_cross_format_function_call_upstream_stream_via_local_finalize_response_impl,
|
||||
);
|
||||
}
|
||||
|
||||
async fn gateway_executes_openai_responses_cross_format_function_call_upstream_stream_via_local_finalize_response_impl(
|
||||
) {
|
||||
use base64::Engine as _;
|
||||
|
||||
@@ -953,8 +968,16 @@ async fn gateway_executes_openai_responses_cross_format_function_call_upstream_s
|
||||
upstream_handle.abort();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn gateway_executes_openai_responses_antigravity_cross_format_upstream_stream_via_local_finalize_response(
|
||||
#[test]
|
||||
fn gateway_executes_openai_responses_antigravity_cross_format_upstream_stream_via_local_finalize_response(
|
||||
) {
|
||||
run_finalize_local_cli_test(
|
||||
"gateway_executes_openai_responses_antigravity_cross_format_upstream_stream_via_local_finalize_response",
|
||||
gateway_executes_openai_responses_antigravity_cross_format_upstream_stream_via_local_finalize_response_impl,
|
||||
);
|
||||
}
|
||||
|
||||
async fn gateway_executes_openai_responses_antigravity_cross_format_upstream_stream_via_local_finalize_response_impl(
|
||||
) {
|
||||
use base64::Engine as _;
|
||||
|
||||
|
||||
@@ -49,8 +49,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn gateway_executes_openai_responses_sync_upstream_stream_via_local_finalize_response() {
|
||||
#[test]
|
||||
fn gateway_executes_openai_responses_sync_upstream_stream_via_local_finalize_response() {
|
||||
run_kiro_claude_cli_finalize_test(
|
||||
"gateway_executes_openai_responses_sync_upstream_stream_via_local_finalize_response",
|
||||
gateway_executes_openai_responses_sync_upstream_stream_via_local_finalize_response_impl,
|
||||
);
|
||||
}
|
||||
|
||||
async fn gateway_executes_openai_responses_sync_upstream_stream_via_local_finalize_response_impl() {
|
||||
use base64::Engine as _;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
@@ -23,6 +23,30 @@ use super::{
|
||||
UsageRuntimeConfig, VideoTaskTruthSourceMode,
|
||||
};
|
||||
|
||||
const FINALIZE_LOCAL_CLI_TEST_STACK_BYTES: usize = 16 * 1024 * 1024;
|
||||
|
||||
fn run_finalize_local_cli_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(FINALIZE_LOCAL_CLI_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("finalize local cli test thread should spawn");
|
||||
|
||||
if let Err(payload) = handle.join() {
|
||||
std::panic::resume_unwind(payload);
|
||||
}
|
||||
}
|
||||
|
||||
mod compact;
|
||||
mod cross_format;
|
||||
mod direct;
|
||||
|
||||
Reference in New Issue
Block a user