mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-12 04:09:48 +08:00
Fix sync chat test stack overflow
This commit is contained in:
@@ -1,18 +1,26 @@
|
|||||||
use super::{
|
use super::{
|
||||||
any, build_router_with_state, build_state_with_execution_runtime_override,
|
any, build_router_with_state, build_state_with_execution_runtime_override,
|
||||||
encrypt_python_fernet_plaintext, json, start_server, to_bytes, Arc, Body, Digest,
|
encrypt_python_fernet_plaintext, json, run_async_test_on_large_stack, start_server, to_bytes,
|
||||||
InMemoryAuthApiKeySnapshotRepository, InMemoryMinimalCandidateSelectionReadRepository,
|
Arc, Body, Digest, InMemoryAuthApiKeySnapshotRepository,
|
||||||
InMemoryProviderCatalogReadRepository, InMemoryRequestCandidateRepository, Json, Mutex,
|
InMemoryMinimalCandidateSelectionReadRepository, InMemoryProviderCatalogReadRepository,
|
||||||
Request, RequestCandidateReadRepository, RequestCandidateStatus, Router, Sha256, StatusCode,
|
InMemoryRequestCandidateRepository, Json, Mutex, Request, RequestCandidateReadRepository,
|
||||||
StoredAuthApiKeySnapshot, StoredMinimalCandidateSelectionRow, StoredProviderCatalogEndpoint,
|
RequestCandidateStatus, Router, Sha256, StatusCode, StoredAuthApiKeySnapshot,
|
||||||
StoredProviderCatalogKey, StoredProviderCatalogProvider, StoredProviderModelMapping,
|
StoredMinimalCandidateSelectionRow, StoredProviderCatalogEndpoint, StoredProviderCatalogKey,
|
||||||
DEVELOPMENT_ENCRYPTION_KEY, EXECUTION_PATH_EXECUTION_RUNTIME_SYNC, EXECUTION_PATH_HEADER,
|
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,
|
EXECUTION_PATH_LOCAL_EXECUTION_RUNTIME_MISS, LOCAL_EXECUTION_RUNTIME_MISS_REASON_HEADER,
|
||||||
TRACE_ID_HEADER,
|
TRACE_ID_HEADER,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[tokio::test]
|
#[test]
|
||||||
async fn gateway_skips_unsupported_local_openai_chat_sync_candidate_before_trying_next_one() {
|
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)]
|
#[derive(Debug, Clone)]
|
||||||
struct SeenExecutionRuntimeSyncRequest {
|
struct SeenExecutionRuntimeSyncRequest {
|
||||||
trace_id: String,
|
trace_id: String,
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
use super::{
|
use super::{
|
||||||
any, build_router_with_state, build_state_with_execution_runtime_override,
|
any, build_router_with_state, build_state_with_execution_runtime_override,
|
||||||
encrypt_python_fernet_plaintext, json, start_server, to_bytes, AppState, Arc, Body, Digest,
|
encrypt_python_fernet_plaintext, json, run_async_test_on_large_stack, start_server, to_bytes,
|
||||||
InMemoryAuthApiKeySnapshotRepository, InMemoryMinimalCandidateSelectionReadRepository,
|
AppState, Arc, Body, Digest, InMemoryAuthApiKeySnapshotRepository,
|
||||||
InMemoryProviderCatalogReadRepository, InMemoryRequestCandidateRepository, Json, Mutex,
|
InMemoryMinimalCandidateSelectionReadRepository, InMemoryProviderCatalogReadRepository,
|
||||||
Request, RequestCandidateReadRepository, RequestCandidateStatus, Router, Sha256, StatusCode,
|
InMemoryRequestCandidateRepository, Json, Mutex, Request, RequestCandidateReadRepository,
|
||||||
StoredAuthApiKeySnapshot, StoredMinimalCandidateSelectionRow, StoredProviderCatalogEndpoint,
|
RequestCandidateStatus, Router, Sha256, StatusCode, StoredAuthApiKeySnapshot,
|
||||||
StoredProviderCatalogKey, StoredProviderCatalogProvider, StoredProviderModelMapping,
|
StoredMinimalCandidateSelectionRow, StoredProviderCatalogEndpoint, StoredProviderCatalogKey,
|
||||||
DEVELOPMENT_ENCRYPTION_KEY, EXECUTION_PATH_EXECUTION_RUNTIME_SYNC, EXECUTION_PATH_HEADER,
|
StoredProviderCatalogProvider, StoredProviderModelMapping, DEVELOPMENT_ENCRYPTION_KEY,
|
||||||
TRACE_ID_HEADER,
|
EXECUTION_PATH_EXECUTION_RUNTIME_SYNC, EXECUTION_PATH_HEADER, TRACE_ID_HEADER,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
@@ -377,8 +377,15 @@ async fn proxy_pii_redaction_local_openai_chat_runtime_masks_headers_and_restore
|
|||||||
provider_handle.abort();
|
provider_handle.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[test]
|
||||||
async fn gateway_executes_openai_chat_sync_via_local_decision_gate_without_execution_runtime_override(
|
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)]
|
#[derive(Debug, Clone)]
|
||||||
struct SeenUpstreamSyncRequest {
|
struct SeenUpstreamSyncRequest {
|
||||||
|
|||||||
@@ -9,6 +9,27 @@ use http::header::{HeaderName, HeaderValue};
|
|||||||
use http::StatusCode;
|
use http::StatusCode;
|
||||||
use serde_json::json;
|
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::{
|
use crate::constants::{
|
||||||
CONTROL_EXECUTED_HEADER, CONTROL_EXECUTE_FALLBACK_HEADER, DEPENDENCY_REASON_HEADER,
|
CONTROL_EXECUTED_HEADER, CONTROL_EXECUTE_FALLBACK_HEADER, DEPENDENCY_REASON_HEADER,
|
||||||
EXECUTION_PATH_EXECUTION_RUNTIME_STREAM, EXECUTION_PATH_EXECUTION_RUNTIME_SYNC,
|
EXECUTION_PATH_EXECUTION_RUNTIME_STREAM, EXECUTION_PATH_EXECUTION_RUNTIME_SYNC,
|
||||||
|
|||||||
Reference in New Issue
Block a user