fix: relax v02 runtime ready source gate
This commit is contained in:
@@ -14,6 +14,10 @@ function taskByName(pipeline, name) {
|
||||
test("v02 render follows TypeScript runtime checks and does not self-patch bootstrap RBAC", async () => {
|
||||
const outDir = await mkdtemp(path.join(os.tmpdir(), "hwlab-v02-render-test-"));
|
||||
try {
|
||||
const head = spawnSync("git", ["rev-parse", "HEAD"], { cwd: process.cwd(), encoding: "utf8" });
|
||||
assert.equal(head.status, 0, head.stderr || head.stdout);
|
||||
const sourceRevision = head.stdout.trim();
|
||||
|
||||
const render = spawnSync(process.execPath, [
|
||||
"scripts/g14-gitops-render.mjs",
|
||||
"--lane", "v02",
|
||||
@@ -35,6 +39,10 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
|
||||
assert.match(pipeline, /process\.exitCode = 1/u);
|
||||
assert.match(pipeline, /item\.spec\?\.template\?\.metadata\?\.labels\?\.\[\\"hwlab\.pikastech\.local\/source-commit\\"\]/u);
|
||||
|
||||
const runtimeReady = taskByName(pipelineJson, "runtime-ready");
|
||||
const runtimeReadyScript = runtimeReady.taskSpec.steps[0].script;
|
||||
assert.match(runtimeReadyScript, /status: "degraded", reason: "source-commit-refresh-timeout"/u);
|
||||
|
||||
const removedServiceIds = [
|
||||
"hwlab-router",
|
||||
"hwlab-tunnel-client",
|
||||
@@ -65,6 +73,7 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
|
||||
}
|
||||
|
||||
const workloads = await readFile(path.join(outDir, "runtime-v02", "workloads.yaml"), "utf8");
|
||||
const workloadsJson = JSON.parse(workloads);
|
||||
const services = await readFile(path.join(outDir, "runtime-v02", "services.yaml"), "utf8");
|
||||
for (const serviceId of removedServiceIds) {
|
||||
assert.doesNotMatch(workloads, new RegExp(serviceId, "u"));
|
||||
@@ -73,6 +82,13 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
|
||||
assert.match(workloads, /"name": "HWLAB_ACCESS_CONTROL_REQUIRED"[\s\S]{0,80}"value": "1"/u);
|
||||
assert.match(workloads, /"name": "HWLAB_BOOTSTRAP_ADMIN_PASSWORD_HASH"/u);
|
||||
assert.match(workloads, /"name": "hwlab-v02-bootstrap-admin"/u);
|
||||
const workloadTemplates = workloadsJson.items.filter((item) => item.spec?.template?.metadata?.labels?.["hwlab.pikastech.local/source-commit"]);
|
||||
assert.ok(workloadTemplates.length > 0, "expected rendered pod-template source labels");
|
||||
for (const item of workloadTemplates) {
|
||||
assert.equal(item.spec.template.metadata.labels["hwlab.pikastech.local/source-commit"], sourceRevision);
|
||||
assert.equal(item.spec.template.metadata.annotations["hwlab.pikastech.local/source-commit"], sourceRevision);
|
||||
}
|
||||
assert.ok(workloadTemplates.some((item) => item.spec.template.metadata.labels["hwlab.pikastech.local/artifact-source-commit"]), "expected artifact source labels on pod templates");
|
||||
assert.doesNotMatch(workloads, /HWLAB_GATEWAY_SIMU_URL/u);
|
||||
assert.doesNotMatch(workloads, /HWLAB_BOX_SIMU_URL/u);
|
||||
assert.doesNotMatch(workloads, /HWLAB_PATCH_PANEL_URL/u);
|
||||
|
||||
Reference in New Issue
Block a user