aKode fase 2b-1 (WIP): rimossi cloud-config, apps MCP ChatGPT, upload file, connectors-extension, rate limits backend; plugin remoti in corso (test non ancora compilanti)
Some checks failed
blocking-ci / Bazel (push) Has been cancelled
blocking-ci / Blob size policy (push) Has been cancelled
blocking-ci / cargo-deny (push) Has been cancelled
blocking-ci / Codespell (push) Has been cancelled
blocking-ci / repo-checks (push) Has been cancelled
blocking-ci / rust-ci (push) Has been cancelled
blocking-ci / sdk (push) Has been cancelled
blocking-ci / CI required (push) Has been cancelled
postmerge-ci / rust-ci-full (push) Has been cancelled
postmerge-ci / v8-canary (push) Has been cancelled
postmerge-ci / Postmerge CI results (push) Has been cancelled
Some checks failed
blocking-ci / Bazel (push) Has been cancelled
blocking-ci / Blob size policy (push) Has been cancelled
blocking-ci / cargo-deny (push) Has been cancelled
blocking-ci / Codespell (push) Has been cancelled
blocking-ci / repo-checks (push) Has been cancelled
blocking-ci / rust-ci (push) Has been cancelled
blocking-ci / sdk (push) Has been cancelled
blocking-ci / CI required (push) Has been cancelled
postmerge-ci / rust-ci-full (push) Has been cancelled
postmerge-ci / v8-canary (push) Has been cancelled
postmerge-ci / Postmerge CI results (push) Has been cancelled
This commit is contained in:
@@ -28,7 +28,7 @@ async fn embedded_transports_stay_blocked_until_the_same_policy_is_published() -
|
||||
let server = MockServer::start().await;
|
||||
Mock::given(method("GET"))
|
||||
.respond_with(ResponseTemplate::new(200))
|
||||
.expect(2)
|
||||
.expect(1)
|
||||
.mount(&server)
|
||||
.await;
|
||||
let home = tempdir()?;
|
||||
@@ -44,28 +44,15 @@ async fn embedded_transports_stay_blocked_until_the_same_policy_is_published() -
|
||||
.build()
|
||||
.await?;
|
||||
config.chatgpt_base_url = server.uri();
|
||||
let cloud_endpoint = format!("{}/api/codex/config/bundle", server.uri());
|
||||
let policy = EmbeddedNetworkPolicy::load(&overrides).await;
|
||||
let bootstrap_auth = policy.bind_bootstrap_auth(config.auth_config());
|
||||
let bootstrap = bootstrap_auth
|
||||
.auth_route_config
|
||||
.http_client_factory()
|
||||
.build_client(&cloud_endpoint, ClientRouteClass::Auth)?;
|
||||
let application = policy
|
||||
.bind(config.http_client_factory())
|
||||
.build_client(&server.uri(), ClientRouteClass::Other)?;
|
||||
assert!(bootstrap.get(&cloud_endpoint).send().await.is_err());
|
||||
assert!(application.get(server.uri()).send().await.is_err());
|
||||
policy.activate(&mut config);
|
||||
let caller_factory = config.http_client_factory();
|
||||
let caller_client = caller_factory.build_client(&server.uri(), ClientRouteClass::Other)?;
|
||||
let worktree_bootstrap = policy.clone().bind_bootstrap_auth(config.auth_config());
|
||||
let worktree_client = worktree_bootstrap
|
||||
.auth_route_config
|
||||
.http_client_factory()
|
||||
.build_client(&cloud_endpoint, ClientRouteClass::Auth)?;
|
||||
assert!(caller_client.get(server.uri()).send().await.is_err());
|
||||
assert!(worktree_client.get(&cloud_endpoint).send().await.is_err());
|
||||
assert!(
|
||||
caller_factory
|
||||
.network_policy()
|
||||
@@ -86,29 +73,17 @@ async fn embedded_transports_stay_blocked_until_the_same_policy_is_published() -
|
||||
|
||||
std::fs::remove_file(&requirements)?;
|
||||
let unrestricted = manager.refresh_application_network_policy().await?;
|
||||
let unrelated_endpoint = format!("{}/not-the-config-endpoint", server.uri()).parse()?;
|
||||
assert_eq!(
|
||||
bootstrap_auth
|
||||
.auth_route_config
|
||||
.http_client_factory()
|
||||
.network_policy()
|
||||
.acquire(&unrelated_endpoint)
|
||||
.map(|_| ()),
|
||||
Err(NetworkPolicyDenied::Destination),
|
||||
);
|
||||
caller_client.get(server.uri()).send().await?;
|
||||
worktree_client.get(&cloud_endpoint).send().await?;
|
||||
assert!(
|
||||
caller_factory
|
||||
.network_policy()
|
||||
.acquire_for_unsupported_sdk()
|
||||
.is_ok()
|
||||
);
|
||||
assert_eq!(server.received_requests().await.unwrap().len(), 2);
|
||||
assert_eq!(server.received_requests().await.unwrap().len(), 1);
|
||||
std::fs::write(&requirements, "[malformed")?;
|
||||
assert!(manager.refresh_application_network_policy().await.is_err());
|
||||
assert!(caller_client.get(server.uri()).send().await.is_err());
|
||||
assert!(worktree_client.get(&cloud_endpoint).send().await.is_err());
|
||||
assert!(
|
||||
caller_factory
|
||||
.network_policy()
|
||||
|
||||
Reference in New Issue
Block a user