fix: scope v03 secret-plane smoke to D601
This commit is contained in:
@@ -549,7 +549,7 @@ test("v03 render keeps node identity as data instead of generated structure", as
|
||||
"scripts/run-bun.mjs",
|
||||
"scripts/gitops-render.mjs",
|
||||
"--lane", "v03",
|
||||
"--node", "G14",
|
||||
"--node", "D601",
|
||||
"--catalog-path", staleCatalogPath,
|
||||
"--image-tag-mode", "full",
|
||||
"--source-branch", "v0.3",
|
||||
@@ -630,10 +630,82 @@ test("v03 render keeps node identity as data instead of generated structure", as
|
||||
.flatMap((container) => container.env ?? [])
|
||||
.filter((entry) => entry.name === "HWLAB_CODE_AGENT_AGENTRUN_PROVIDER_ID");
|
||||
assert.ok(agentRunNodeEnv.length > 0, "expected AgentRun provider id env to carry configured node id");
|
||||
assert.deepEqual([...new Set(agentRunNodeEnv.map((entry) => entry.value))], ["G14"]);
|
||||
assert.deepEqual([...new Set(agentRunNodeEnv.map((entry) => entry.value))], ["D601"]);
|
||||
|
||||
} finally {
|
||||
await rm(outDir, { recursive: true, force: true });
|
||||
await rm(scratchDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("v03 render skips D601 secret-plane smoke on D518 gitops root", async () => {
|
||||
const outDir = await mkdtemp(path.join(os.tmpdir(), "hwlab-v03-d518-render-test-"));
|
||||
const scratchDir = path.join(".tmp", `gitops-render-v03-d518-${process.pid}-${Date.now()}`);
|
||||
const staleCatalogPath = path.join(scratchDir, "artifact-catalog.v03.json");
|
||||
try {
|
||||
const staleRevision = "0".repeat(40);
|
||||
await mkdir(scratchDir, { recursive: true });
|
||||
await writeFile(staleCatalogPath, JSON.stringify({
|
||||
catalogVersion: "v1",
|
||||
kind: "hwlab-artifact-catalog",
|
||||
environment: "v03",
|
||||
profile: "v03",
|
||||
namespace: "hwlab-v03",
|
||||
commitId: staleRevision.slice(0, 12),
|
||||
artifactState: "ready",
|
||||
services: [{
|
||||
serviceId: "hwlab-cloud-api",
|
||||
runtimeMode: "env-reuse-git-mirror-checkout",
|
||||
envReuse: true,
|
||||
sourceCommitId: staleRevision,
|
||||
commitId: staleRevision,
|
||||
image: "127.0.0.1:5000/hwlab/hwlab-cloud-api-env:env-stale",
|
||||
imageTag: "env-stale",
|
||||
digest: `sha256:${"1".repeat(64)}`,
|
||||
environmentImage: "127.0.0.1:5000/hwlab/hwlab-cloud-api-env:env-stale",
|
||||
environmentDigest: `sha256:${"1".repeat(64)}`,
|
||||
environmentInputHash: "e".repeat(64),
|
||||
codeInputHash: "c".repeat(64),
|
||||
bootRepo: "git@github.com:pikasTech/HWLAB.git",
|
||||
bootCommit: staleRevision,
|
||||
bootSh: "deploy/runtime/boot/hwlab-cloud-api.sh"
|
||||
}]
|
||||
}, null, 2));
|
||||
const render = spawnSync(process.execPath, [
|
||||
"scripts/run-bun.mjs",
|
||||
"scripts/gitops-render.mjs",
|
||||
"--lane", "v03",
|
||||
"--catalog-path", staleCatalogPath,
|
||||
"--image-tag-mode", "full",
|
||||
"--source-branch", "v0.3",
|
||||
"--gitops-branch", "v0.3-gitops",
|
||||
"--gitops-root", "deploy/gitops/node/d518",
|
||||
"--out", outDir,
|
||||
"--source-revision", "HEAD"
|
||||
], { cwd: process.cwd(), encoding: "utf8" });
|
||||
assert.equal(render.status, 0, render.stderr || render.stdout);
|
||||
|
||||
const generatedFiles = await collectGeneratedFiles(outDir);
|
||||
const generatedPaths = generatedFiles.map((filePath) => path.relative(outDir, filePath));
|
||||
assert.ok(generatedPaths.includes("runtime-v03/kustomization.yaml"));
|
||||
assert.ok(generatedPaths.includes("runtime-v03/workloads.yaml"));
|
||||
assert.equal(generatedPaths.includes("runtime-v03/external-secrets.yaml"), false);
|
||||
const kustomization = await readFile(path.join(outDir, "runtime-v03", "kustomization.yaml"), "utf8");
|
||||
assert.doesNotMatch(kustomization, /external-secrets\.yaml/u);
|
||||
|
||||
const workloadsJson = JSON.parse(await readFile(path.join(outDir, "runtime-v03", "workloads.yaml"), "utf8"));
|
||||
const cloudApi = (workloadsJson.items ?? []).find((item) => item.kind === "Deployment" && item.metadata?.name === "hwlab-cloud-api");
|
||||
const cloudApiContainer = collectContainersFromItem(cloudApi).find((container) => container.name === "hwlab-cloud-api");
|
||||
const cloudApiEnvEntries = new Map((cloudApiContainer?.env ?? []).map((entry) => [entry.name, entry]));
|
||||
assert.deepEqual(cloudApiEnvEntries.get("HWLAB_SECRET_PLANE_SMOKE")?.valueFrom?.secretKeyRef, { name: "hwlab-secret-plane-smoke", key: "password", optional: true });
|
||||
const agentRunNodeEnv = (workloadsJson.items ?? [])
|
||||
.flatMap((item) => collectContainersFromItem(item))
|
||||
.flatMap((container) => container.env ?? [])
|
||||
.filter((entry) => entry.name === "HWLAB_CODE_AGENT_AGENTRUN_PROVIDER_ID");
|
||||
assert.ok(agentRunNodeEnv.length > 0, "expected D518 node id to be inferred from gitops root");
|
||||
assert.deepEqual([...new Set(agentRunNodeEnv.map((entry) => entry.value))], ["D518"]);
|
||||
} finally {
|
||||
await rm(outDir, { recursive: true, force: true });
|
||||
await rm(scratchDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user