gcp-ai: the tests' fake gcloud runs on the test's own runtime, not PATH's node
publish.yml has been red since e801e43 (#307): 20 gcp-ai tests fail with
"gcloud could not read Google Cloud credentials or configuration". CI runs
every package in one bun process from the repo root. grok's nocli.mjs
sets PATH to /usr/bin:/bin for the rest of that process, and setup-node's
node is not there, so the fake gcloud's `#!/usr/bin/env node` could not
start. Run alone, gcp-ai passed, which is how the merge was verified.
The fake's shebang now names process.execPath. The fake stays pinned by
path in each test and CLOUDSDK_CONFIG stays under the test's own HOME.
Run: `bun test packages/grok packages/gcp-ai` from the repo root, with
HOME a sandbox dir and the network pointed at 127.0.0.1:9: 20 fail before
(the CI list, plus "closing a login waits..." at its 30s bar), 122 pass
0 fail after. Full root run `HOME=<sandbox> bun test` and
`bun scripts/check.mjs` at the pushed head: see below. Linux: the 5
browser tests pass in oven/bun:1.4.2 with apt chromium (--no-sandbox
wrapper through VERTEX_CHROME_PATH), the passive sign-in one in 11s.
This commit is contained in:
@@ -15,7 +15,11 @@ export async function fakeGcloud() {
|
||||
// sides meet at $HOME/.config/gcloud: the fake gcloud writes there, and so
|
||||
// does the plugin's own account directories stay out of it.
|
||||
const sdk = join(directory, ".config", "gcloud")
|
||||
await writeFile(join(directory, "gcloud"), `#!/usr/bin/env node
|
||||
// The fake runs on this test's own runtime, named by path: another
|
||||
// package's tests in the same run may leave PATH without node (grok's
|
||||
// nocli.mjs keeps only /usr/bin and /bin), and setup-node's node is not
|
||||
// there on CI.
|
||||
await writeFile(join(directory, "gcloud"), `#!${process.execPath}
|
||||
import { appendFileSync, readFileSync } from "node:fs"
|
||||
import { join } from "node:path"
|
||||
const state = JSON.parse(readFileSync(process.env.VERTEX_TEST_GCLOUD, "utf8"))
|
||||
|
||||
Reference in New Issue
Block a user