aKode fase 5: test e snapshot adeguati alla rinomina, 429 distinto (ProviderRateLimited), cargo fmt dopo il cambio dei prefissi
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -724,8 +724,8 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use super::BuildCustomCaTransportError;
|
||||
use super::AKODE_CA_CERT_ENV;
|
||||
use super::BuildCustomCaTransportError;
|
||||
use super::EnvSource;
|
||||
use super::SSL_CERT_FILE_ENV;
|
||||
use super::maybe_build_rustls_client_config_with_env;
|
||||
|
||||
@@ -84,8 +84,8 @@ pub fn is_openai_api_url(destination: &str) -> bool {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::OpenAiDestination;
|
||||
use super::is_allowed_chatgpt_host;
|
||||
use super::classify_openai_api_url;
|
||||
use super::is_allowed_chatgpt_host;
|
||||
use super::is_openai_api_url;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -35,7 +35,11 @@ impl RetryAfter {
|
||||
let now = SystemTime::now();
|
||||
let received_at = Instant::now();
|
||||
let value = value.trim();
|
||||
if value.is_empty() || !value.bytes().all(|byte| byte.is_ascii_digit() || byte == b'.') {
|
||||
if value.is_empty()
|
||||
|| !value
|
||||
.bytes()
|
||||
.all(|byte| byte.is_ascii_digit() || byte == b'.')
|
||||
{
|
||||
return None;
|
||||
}
|
||||
let number: f64 = value.parse().ok()?;
|
||||
|
||||
@@ -307,10 +307,9 @@ impl RouteAwareClientPool {
|
||||
route: OutboundProxyRoute,
|
||||
) -> Result<Self, BuildRouteAwareHttpClientError> {
|
||||
let mut pool = Self::with_builder(http_client_factory, route_class, client_builder);
|
||||
let client = pool.client_builder_for_route().build_for_resolved_route(
|
||||
pool.route_class,
|
||||
&route,
|
||||
)?;
|
||||
let client = pool
|
||||
.client_builder_for_route()
|
||||
.build_for_resolved_route(pool.route_class, &route)?;
|
||||
pool.clients = Arc::new(Mutex::new(HashMap::from([(route, client)])));
|
||||
Ok(pool)
|
||||
}
|
||||
@@ -488,10 +487,7 @@ impl RouteAwareClientPool {
|
||||
| (
|
||||
OutboundProxyPolicy::RespectSystemProxy,
|
||||
CustomCaFallback::LegacyTransportDefault,
|
||||
) => client_builder.build_for_resolved_route(
|
||||
pool.route_class,
|
||||
&build_route,
|
||||
),
|
||||
) => client_builder.build_for_resolved_route(pool.route_class, &build_route),
|
||||
}?;
|
||||
let mut clients = pool.clients.lock().unwrap_or_else(|error| {
|
||||
panic!("route-aware client cache lock should not be poisoned: {error}")
|
||||
|
||||
@@ -540,10 +540,7 @@ async fn cached_tls_backend_only_changes_its_destination_and_route() {
|
||||
]));
|
||||
let fallback_client = HttpClientBuilder::new()
|
||||
.with_rustls_tls()
|
||||
.build_for_resolved_route(
|
||||
ClientRouteClass::Api,
|
||||
&OutboundProxyRoute::Direct,
|
||||
)
|
||||
.build_for_resolved_route(ClientRouteClass::Api, &OutboundProxyRoute::Direct)
|
||||
.expect("rustls client should build without proxy autodiscovery");
|
||||
pool.rustls_clients
|
||||
.as_ref()
|
||||
|
||||
@@ -206,9 +206,6 @@ fn evicting_a_destination_removes_its_unshared_route_client() {
|
||||
fn direct_rustls_client() -> crate::client::TransportClient {
|
||||
HttpClientBuilder::new()
|
||||
.with_rustls_tls()
|
||||
.build_for_resolved_route(
|
||||
crate::ClientRouteClass::Api,
|
||||
&OutboundProxyRoute::Direct,
|
||||
)
|
||||
.build_for_resolved_route(crate::ClientRouteClass::Api, &OutboundProxyRoute::Direct)
|
||||
.expect("rustls client should build without proxy autodiscovery")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user