From add66fc9543d5e18732b0c8ba3a295e754c3bddd Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 3 Nov 2026 18:20:55 +0800 Subject: [PATCH] gcp-ai: the usage-options test asks no gcloud before the options are read (#667) 48a5f21's "the usage hook takes the billing, currency and profile maps" test signed in with an accountId, so each of its usage calls first asked gcloud for a token. On the publish run's ubuntu runner that took past bun's 5s per-test limit, the test job went red, and gcp-ai 0.1.5 was not published. The test now has no account, so nothing is asked before the options are read and refused; it checks the same errors. Run at this head on mote: `HOME=$(mktemp -d) bun test` (as publish.yml runs it): 5195 pass, 0 fail, the test in 1.14ms. node --test packages/gcp-ai/test/*.test.mjs: 84 tests, 81 pass, 3 skipped, 0 fail. bun scripts/check.mjs: ok. Not tried: the ubuntu runner itself; the first publish run on it will show it. --- packages/gcp-ai/test/plugin.test.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/gcp-ai/test/plugin.test.mjs b/packages/gcp-ai/test/plugin.test.mjs index 67f6ee2..79ca411 100644 --- a/packages/gcp-ai/test/plugin.test.mjs +++ b/packages/gcp-ai/test/plugin.test.mjs @@ -1153,7 +1153,8 @@ test("account settings beat the row, and row settings beat environment defaults" }) test("the usage hook takes the billing, currency and profile maps from the provider's or the plugin's options", async () => { - const auth = { accountId: "reader@example.com" } + // No account: nothing asks gcloud for a token before the options are read. + const auth = { type: "success" } for (const [name, bad, wanted] of [ ["billingAccounts", { "example-project": "nope" }, /billingAccounts: /], ["billingCurrencies", { "AAAAAA-BBBBBB-CCCCCC": "EUR" }, /billingCurrencies: "EUR" is not a currency/],