mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-21 04:12:08 +03:00
test(cli): remove flaky managed service environment test (#56272)
This commit is contained in:
committed by
GitHub
Unverified
parent
07bbd0fd16
commit
543b42ec2c
@@ -192,62 +192,6 @@ test("service config manages environment variables", async () => {
|
||||
}
|
||||
})
|
||||
|
||||
test("managed service loads configured environment", async () => {
|
||||
const root = await fs.mkdtemp(path.join(os.tmpdir(), "opencode-service-env-"))
|
||||
const registration = path.join(root, "state", "opencode", ServiceConfig.filename())
|
||||
await fs.mkdir(path.join(root, "config"), { recursive: true })
|
||||
await fs.writeFile(
|
||||
path.join(root, "config", ServiceConfig.filename()),
|
||||
JSON.stringify({ env: { OPENCODE_SERVICE_ENV_TEST: "configured", OPENCODE_SERVICE_ENV_EMPTY_TEST: "" } }),
|
||||
)
|
||||
await fs.writeFile(
|
||||
path.join(root, "config", "opencode.json"),
|
||||
JSON.stringify({
|
||||
mcp: {
|
||||
servers: {
|
||||
env: {
|
||||
type: "local",
|
||||
command: ["true"],
|
||||
environment: {
|
||||
configured: "{env:OPENCODE_SERVICE_ENV_TEST}",
|
||||
empty: "{env:OPENCODE_SERVICE_ENV_EMPTY_TEST}",
|
||||
inherited: "{env:OPENCODE_SERVICE_ENV_INHERITED_TEST}",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
)
|
||||
const owner = Bun.spawn(
|
||||
[process.execPath, path.join(import.meta.dir, "../src/index.ts"), "serve", "--service", "--port", "0"],
|
||||
{
|
||||
env: isolatedEnv(root, {
|
||||
OPENCODE_SERVICE_ENV_TEST: "inherited",
|
||||
OPENCODE_SERVICE_ENV_EMPTY_TEST: "inherited",
|
||||
OPENCODE_SERVICE_ENV_INHERITED_TEST: "inherited",
|
||||
}),
|
||||
stderr: "pipe",
|
||||
stdout: "ignore",
|
||||
},
|
||||
)
|
||||
try {
|
||||
const info = await waitForInfo(registration)
|
||||
const url = new URL("/api/config", info.url)
|
||||
url.searchParams.set("location[directory]", root)
|
||||
const response = await fetch(url, { headers: { authorization: "Basic " + btoa(`opencode:${info.password}`) } })
|
||||
expect(response.status).toBe(200)
|
||||
expect((await response.json())[0].info.mcp.servers.env.environment).toEqual({
|
||||
configured: "configured",
|
||||
empty: "",
|
||||
inherited: "inherited",
|
||||
})
|
||||
} finally {
|
||||
owner.kill("SIGTERM")
|
||||
await owner.exited
|
||||
await fs.rm(root, { recursive: true, force: true })
|
||||
}
|
||||
}, 30_000)
|
||||
|
||||
test("service filenames share release channels and identify preview channels", () => {
|
||||
expect(ServiceConfig.filename("latest")).toBe("service.json")
|
||||
expect(ServiceConfig.filename("dev")).toBe("service.json")
|
||||
|
||||
Reference in New Issue
Block a user