Skip to content

Commit 712eb96

Browse files
committed
test: inject fake console token in proxy e2e so requests reach the proxy
app list resolves a console credential before issuing any request, so in CI (no ~/.bailian/config.json, no credentials) it exited with an AUTH error before fetch ran — the proxy received zero CONNECTs and the "routes through proxy" assertions failed. Locally these passed only because a real config.json supplied a token. Inject a fake DASHSCOPE_ACCESS_TOKEN (highest-priority credential source) so the request is actually issued and intercepted by the local CONNECT proxy. The target stays a .invalid host, so still no real network traffic.
1 parent 0706cae commit 712eb96

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/cli/tests/e2e/proxy.e2e.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@ afterAll(async () => {
3030
await new Promise<void>((resolve) => proxy.close(() => resolve()));
3131
});
3232

33+
/**
34+
* 注入假 console 凭证:`app list` 在发请求前会解析 console 凭证(`resolveConsoleGatewayCredential`),
35+
* CI 上无 `~/.bailian/config.json` 也无凭证时会先抛 AUTH 错误、走不到 fetch,代理便收不到 CONNECT。
36+
* `DASHSCOPE_ACCESS_TOKEN` 优先级最高,注入任意假值即可让请求真正发出、被代理拦截(目标域 .invalid 仍不产生外网流量)。
37+
*/
3338
const PROXY_ENV_CLEARED = {
3439
HTTPS_PROXY: "",
3540
https_proxy: "",
3641
HTTP_PROXY: "",
3742
http_proxy: "",
3843
NO_PROXY: "",
3944
no_proxy: "",
45+
DASHSCOPE_ACCESS_TOKEN: "bl-proxy-e2e-fake-token",
4046
};
4147

4248
describe("e2e: proxy", () => {

0 commit comments

Comments
 (0)