|
1 | 1 | // Docker E2E Plan tests cover docker e2e plan script behavior. |
2 | | -import { readFileSync } from "node:fs"; |
3 | | -import { describe, expect, it } from "vitest"; |
| 2 | +import { execFileSync } from "node:child_process"; |
| 3 | +import { copyFileSync, mkdirSync, readFileSync } from "node:fs"; |
| 4 | +import { dirname, join } from "node:path"; |
| 5 | +import { afterEach, describe, expect, it } from "vitest"; |
| 6 | +import { useAutoCleanupTempDirTracker } from "../helpers/temp-dir.js"; |
4 | 7 | import { |
5 | 8 | DEFAULT_LIVE_RETRIES, |
6 | 9 | RELEASE_PATH_PROFILE, |
7 | 10 | parseLaneSelection, |
8 | 11 | resolveDockerE2ePlan, |
9 | 12 | } from "../../scripts/lib/docker-e2e-plan.mjs"; |
10 | | -import { BUNDLED_PLUGIN_INSTALL_UNINSTALL_SHARDS } from "../../scripts/lib/docker-e2e-scenarios.mjs"; |
| 13 | +import { |
| 14 | + allReleasePathLanes, |
| 15 | + BUNDLED_PLUGIN_INSTALL_UNINSTALL_SHARDS, |
| 16 | +} from "../../scripts/lib/docker-e2e-scenarios.mjs"; |
11 | 17 |
|
| 18 | +const tempDirs = useAutoCleanupTempDirTracker(afterEach); |
12 | 19 | const orderLanes = <T>(lanes: T[]) => lanes; |
13 | 20 | const packageJson = JSON.parse(readFileSync("package.json", "utf8")) as { |
14 | 21 | scripts?: Record<string, string>; |
@@ -97,6 +104,57 @@ function bundledPluginSweepLane(index: number): ReturnType<typeof summarizeLane> |
97 | 104 | } |
98 | 105 |
|
99 | 106 | describe("scripts/lib/docker-e2e-plan", () => { |
| 107 | + it("routes live Docker scripts through the nested trusted release harness", () => { |
| 108 | + const sourceLane = allReleasePathLanes({ releaseProfile: "beta" }).find( |
| 109 | + (candidate) => candidate.name === "live-codex-npm-plugin", |
| 110 | + ); |
| 111 | + const tempRoot = tempDirs.make("openclaw-release-harness-"); |
| 112 | + const nestedModule = join( |
| 113 | + tempRoot, |
| 114 | + ".release-harness", |
| 115 | + "scripts", |
| 116 | + "lib", |
| 117 | + "docker-e2e-scenarios.mjs", |
| 118 | + ); |
| 119 | + |
| 120 | + expect(sourceLane?.command).toContain( |
| 121 | + 'harness="${OPENCLAW_DOCKER_E2E_TRUSTED_HARNESS_DIR:-.}"', |
| 122 | + ); |
| 123 | + |
| 124 | + mkdirSync(dirname(nestedModule), { recursive: true }); |
| 125 | + copyFileSync("scripts/lib/docker-e2e-scenarios.mjs", nestedModule); |
| 126 | + |
| 127 | + const laneJson = execFileSync( |
| 128 | + process.execPath, |
| 129 | + [ |
| 130 | + "--input-type=module", |
| 131 | + "--eval", |
| 132 | + ` |
| 133 | + import { pathToFileURL } from "node:url"; |
| 134 | + const scenarios = await import(pathToFileURL(process.argv[1]).href); |
| 135 | + const lane = scenarios |
| 136 | + .allReleasePathLanes({ releaseProfile: "beta" }) |
| 137 | + .find((candidate) => candidate.name === "live-codex-npm-plugin"); |
| 138 | + process.stdout.write(JSON.stringify(lane)); |
| 139 | + `, |
| 140 | + nestedModule, |
| 141 | + ], |
| 142 | + { |
| 143 | + encoding: "utf8", |
| 144 | + env: { |
| 145 | + ...process.env, |
| 146 | + OPENCLAW_DOCKER_E2E_REPO_ROOT: tempRoot, |
| 147 | + }, |
| 148 | + }, |
| 149 | + ); |
| 150 | + const lane = JSON.parse(laneJson) as { command: string }; |
| 151 | + |
| 152 | + expect(lane.command).toContain( |
| 153 | + 'harness="${OPENCLAW_DOCKER_E2E_TRUSTED_HARNESS_DIR:-.release-harness}"', |
| 154 | + ); |
| 155 | + expect(lane.command).toContain('bash "$harness/scripts/e2e/codex-npm-plugin-live-docker.sh"'); |
| 156 | + }); |
| 157 | + |
100 | 158 | it("plans package-backed Compose and package artifact proofs", () => { |
101 | 159 | const plan = planFor({ |
102 | 160 | selectedLaneNames: ["compose-setup", "docker-package-install"], |
|
0 commit comments