mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-05 00:47:48 +08:00
Fix sync chat test stack overflow
This commit is contained in:
@@ -1,18 +1,26 @@
|
||||
use super::{
|
||||
any, build_router_with_state, build_state_with_execution_runtime_override,
|
||||
encrypt_python_fernet_plaintext, json, start_server, to_bytes, Arc, Body, Digest,
|
||||
InMemoryAuthApiKeySnapshotRepository, InMemoryMinimalCandidateSelectionReadRepository,
|
||||
InMemoryProviderCatalogReadRepository, InMemoryRequestCandidateRepository, Json, Mutex,
|
||||
Request, RequestCandidateReadRepository, RequestCandidateStatus, Router, Sha256, StatusCode,
|
||||
StoredAuthApiKeySnapshot, StoredMinimalCandidateSelectionRow, StoredProviderCatalogEndpoint,
|
||||
StoredProviderCatalogKey, StoredProviderCatalogProvider, StoredProviderModelMapping,
|
||||
DEVELOPMENT_ENCRYPTION_KEY, EXECUTION_PATH_EXECUTION_RUNTIME_SYNC, EXECUTION_PATH_HEADER,
|
||||
encrypt_python_fernet_plaintext, json, run_async_test_on_large_stack, start_server, to_bytes,
|
||||
Arc, Body, Digest, InMemoryAuthApiKeySnapshotRepository,
|
||||
InMemoryMinimalCandidateSelectionReadRepository, InMemoryProviderCatalogReadRepository,
|
||||
InMemoryRequestCandidateRepository, Json, Mutex, Request, RequestCandidateReadRepository,
|
||||
RequestCandidateStatus, Router, Sha256, StatusCode, StoredAuthApiKeySnapshot,
|
||||
StoredMinimalCandidateSelectionRow, StoredProviderCatalogEndpoint, StoredProviderCatalogKey,
|
||||
StoredProviderCatalogProvider, StoredProviderModelMapping, DEVELOPMENT_ENCRYPTION_KEY,
|
||||
EXECUTION_PATH_EXECUTION_RUNTIME_SYNC, EXECUTION_PATH_HEADER,
|
||||
EXECUTION_PATH_LOCAL_EXECUTION_RUNTIME_MISS, LOCAL_EXECUTION_RUNTIME_MISS_REASON_HEADER,
|
||||
TRACE_ID_HEADER,
|
||||
};
|
||||
|
||||
#[tokio::test]
|
||||
async fn gateway_skips_unsupported_local_openai_chat_sync_candidate_before_trying_next_one() {
|
||||
#[test]
|
||||
fn gateway_skips_unsupported_local_openai_chat_sync_candidate_before_trying_next_one() {
|
||||
run_async_test_on_large_stack(
|
||||
"gateway_skips_unsupported_local_openai_chat_sync_candidate_before_trying_next_one",
|
||||
gateway_skips_unsupported_local_openai_chat_sync_candidate_before_trying_next_one_impl(),
|
||||
);
|
||||
}
|
||||
|
||||
async fn gateway_skips_unsupported_local_openai_chat_sync_candidate_before_trying_next_one_impl() {
|
||||
#[derive(Debug, Clone)]
|
||||
struct SeenExecutionRuntimeSyncRequest {
|
||||
trace_id: String,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
use super::{
|
||||
any, build_router_with_state, build_state_with_execution_runtime_override,
|
||||
encrypt_python_fernet_plaintext, json, start_server, to_bytes, AppState, Arc, Body, Digest,
|
||||
InMemoryAuthApiKeySnapshotRepository, InMemoryMinimalCandidateSelectionReadRepository,
|
||||
InMemoryProviderCatalogReadRepository, InMemoryRequestCandidateRepository, Json, Mutex,
|
||||
Request, RequestCandidateReadRepository, RequestCandidateStatus, Router, Sha256, StatusCode,
|
||||
StoredAuthApiKeySnapshot, StoredMinimalCandidateSelectionRow, StoredProviderCatalogEndpoint,
|
||||
StoredProviderCatalogKey, StoredProviderCatalogProvider, StoredProviderModelMapping,
|
||||
DEVELOPMENT_ENCRYPTION_KEY, EXECUTION_PATH_EXECUTION_RUNTIME_SYNC, EXECUTION_PATH_HEADER,
|
||||
TRACE_ID_HEADER,
|
||||
encrypt_python_fernet_plaintext, json, run_async_test_on_large_stack, start_server, to_bytes,
|
||||
AppState, Arc, Body, Digest, InMemoryAuthApiKeySnapshotRepository,
|
||||
InMemoryMinimalCandidateSelectionReadRepository, InMemoryProviderCatalogReadRepository,
|
||||
InMemoryRequestCandidateRepository, Json, Mutex, Request, RequestCandidateReadRepository,
|
||||
RequestCandidateStatus, Router, Sha256, StatusCode, StoredAuthApiKeySnapshot,
|
||||
StoredMinimalCandidateSelectionRow, StoredProviderCatalogEndpoint, StoredProviderCatalogKey,
|
||||
StoredProviderCatalogProvider, StoredProviderModelMapping, DEVELOPMENT_ENCRYPTION_KEY,
|
||||
EXECUTION_PATH_EXECUTION_RUNTIME_SYNC, EXECUTION_PATH_HEADER, TRACE_ID_HEADER,
|
||||
};
|
||||
|
||||
#[tokio::test]
|
||||
@@ -377,8 +377,15 @@ async fn proxy_pii_redaction_local_openai_chat_runtime_masks_headers_and_restore
|
||||
provider_handle.abort();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn gateway_executes_openai_chat_sync_via_local_decision_gate_without_execution_runtime_override(
|
||||
#[test]
|
||||
fn gateway_executes_openai_chat_sync_via_local_decision_gate_without_execution_runtime_override() {
|
||||
run_async_test_on_large_stack(
|
||||
"gateway_executes_openai_chat_sync_via_local_decision_gate_without_execution_runtime_override",
|
||||
gateway_executes_openai_chat_sync_via_local_decision_gate_without_execution_runtime_override_impl(),
|
||||
);
|
||||
}
|
||||
|
||||
async fn gateway_executes_openai_chat_sync_via_local_decision_gate_without_execution_runtime_override_impl(
|
||||
) {
|
||||
#[derive(Debug, Clone)]
|
||||
struct SeenUpstreamSyncRequest {
|
||||
|
||||
@@ -9,6 +9,27 @@ use http::header::{HeaderName, HeaderValue};
|
||||
use http::StatusCode;
|
||||
use serde_json::json;
|
||||
|
||||
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(16 * 1024 * 1024)
|
||||
.spawn(move || {
|
||||
tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.expect("tokio runtime should build")
|
||||
.block_on(future);
|
||||
})
|
||||
.expect("large-stack sync chat test thread should spawn");
|
||||
|
||||
if let Err(payload) = handle.join() {
|
||||
std::panic::resume_unwind(payload);
|
||||
}
|
||||
}
|
||||
|
||||
use crate::constants::{
|
||||
CONTROL_EXECUTED_HEADER, CONTROL_EXECUTE_FALLBACK_HEADER, DEPENDENCY_REASON_HEADER,
|
||||
EXECUTION_PATH_EXECUTION_RUNTIME_STREAM, EXECUTION_PATH_EXECUTION_RUNTIME_SYNC,
|
||||
|
||||
Reference in New Issue
Block a user