feat(lanes): add --qc boot flag + QC_BOOT_ENV for deterministic QC stacks (E1)
This commit is contained in:
@@ -354,6 +354,70 @@ describe("lifecycle", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("upLane qc option", () => {
|
||||
it("injects QC_BOOT_ENV into the boot hook's environment when qc:true", async () => {
|
||||
const lane = makeLane();
|
||||
writeProfile(lane.cwd, "PORTS=web\nPORT_BASE_web=19300\nQC_BOOT_ENV=SOME_QC_VAR=from-qc\n", {
|
||||
boot: [
|
||||
"#!/usr/bin/env bash",
|
||||
"set -euo pipefail",
|
||||
'echo "QC=$SOME_QC_VAR" > "$LANE_DIR/qc-marker.txt"',
|
||||
'harness_spawn web "$LANE_DIR" python3 -m http.server "$WEB_PORT" --bind 127.0.0.1',
|
||||
"",
|
||||
].join("\n"),
|
||||
health: [
|
||||
"#!/usr/bin/env bash",
|
||||
"set -euo pipefail",
|
||||
"for _ in $(seq 1 50); do",
|
||||
' if curl -sf "http://127.0.0.1:$WEB_PORT/" >/dev/null; then exit 0; fi',
|
||||
" sleep 0.2",
|
||||
"done",
|
||||
"exit 1",
|
||||
"",
|
||||
].join("\n"),
|
||||
});
|
||||
|
||||
await runtime.upLane(lanesLib.getLane(lane.id), { qc: true });
|
||||
const booted = lanesLib.getLane(lane.id);
|
||||
const markerPath = pathMod.join(booted.cwd, "qc-marker.txt");
|
||||
const marker = fsMod.readFileSync(markerPath, "utf8");
|
||||
assert.match(marker, /QC=from-qc/);
|
||||
|
||||
slots.releaseSlot(lane.id);
|
||||
});
|
||||
|
||||
it("does not touch the environment when qc is omitted (default false)", async () => {
|
||||
const lane = makeLane();
|
||||
writeProfile(lane.cwd, "PORTS=web\nPORT_BASE_web=19400\nQC_BOOT_ENV=SOME_QC_VAR=from-qc\n", {
|
||||
boot: [
|
||||
"#!/usr/bin/env bash",
|
||||
"set -euo pipefail",
|
||||
'echo "QC=${SOME_QC_VAR:-not-set}" > "$LANE_DIR/qc-marker-no-qc.txt"',
|
||||
'harness_spawn web "$LANE_DIR" python3 -m http.server "$WEB_PORT" --bind 127.0.0.1',
|
||||
"",
|
||||
].join("\n"),
|
||||
health: [
|
||||
"#!/usr/bin/env bash",
|
||||
"set -euo pipefail",
|
||||
"for _ in $(seq 1 50); do",
|
||||
' if curl -sf "http://127.0.0.1:$WEB_PORT/" >/dev/null; then exit 0; fi',
|
||||
" sleep 0.2",
|
||||
"done",
|
||||
"exit 1",
|
||||
"",
|
||||
].join("\n"),
|
||||
});
|
||||
|
||||
await runtime.upLane(lanesLib.getLane(lane.id));
|
||||
const booted = lanesLib.getLane(lane.id);
|
||||
const markerPath = pathMod.join(booted.cwd, "qc-marker-no-qc.txt");
|
||||
const marker = fsMod.readFileSync(markerPath, "utf8");
|
||||
assert.match(marker, /QC=not-set/);
|
||||
|
||||
slots.releaseSlot(lane.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe("allocation is not client-patchable", () => {
|
||||
it("ignores slot and ports coming through updateLane", () => {
|
||||
const lane = makeLane();
|
||||
|
||||
Reference in New Issue
Block a user