fix: keep v02 config hashes label-safe
This commit is contained in:
@@ -243,12 +243,22 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
|
||||
}
|
||||
const frpc = JSON.parse(await readFile(path.join(outDir, "runtime-v02", "g14-frpc.yaml"), "utf8"));
|
||||
const frpcDeployment = frpc.items.find((item) => item.kind === "Deployment");
|
||||
assert.ok(frpcDeployment.spec.template.metadata.labels["hwlab.pikastech.local/config-sha256"]);
|
||||
const frpcConfigLabel = frpcDeployment.spec.template.metadata.labels["hwlab.pikastech.local/config-sha256"];
|
||||
const frpcConfigAnnotation = frpcDeployment.spec.template.metadata.annotations["hwlab.pikastech.local/config-sha256"];
|
||||
assert.ok(frpcConfigLabel);
|
||||
assert.equal(frpcConfigLabel.length <= 63, true);
|
||||
assert.match(frpcConfigAnnotation, /^[a-f0-9]{64}$/u);
|
||||
assert.equal(frpcConfigAnnotation.startsWith(frpcConfigLabel), true);
|
||||
assert.equal(frpcDeployment.spec.template.metadata.labels["hwlab.pikastech.local/source-commit"], undefined);
|
||||
|
||||
const postgres = JSON.parse(await readFile(path.join(outDir, "runtime-v02", "postgres.yaml"), "utf8"));
|
||||
const postgresStatefulSet = postgres.items.find((item) => item.kind === "StatefulSet");
|
||||
assert.ok(postgresStatefulSet.spec.template.metadata.labels["hwlab.pikastech.local/migration-sha256"]);
|
||||
const postgresMigrationLabel = postgresStatefulSet.spec.template.metadata.labels["hwlab.pikastech.local/migration-sha256"];
|
||||
const postgresMigrationAnnotation = postgresStatefulSet.spec.template.metadata.annotations["hwlab.pikastech.local/migration-sha256"];
|
||||
assert.ok(postgresMigrationLabel);
|
||||
assert.equal(postgresMigrationLabel.length <= 63, true);
|
||||
assert.match(postgresMigrationAnnotation, /^[a-f0-9]{64}$/u);
|
||||
assert.equal(postgresMigrationAnnotation.startsWith(postgresMigrationLabel), true);
|
||||
assert.equal(postgresStatefulSet.spec.template.metadata.labels["hwlab.pikastech.local/source-commit"], undefined);
|
||||
|
||||
await assert.rejects(() => readFile(path.join(outDir, "tekton-v02", "control-plane-reconciler.yaml"), "utf8"), { code: "ENOENT" });
|
||||
|
||||
Reference in New Issue
Block a user