38 lines
1.7 KiB
JavaScript
38 lines
1.7 KiB
JavaScript
import { readFileSync, readdirSync } from "node:fs";
|
|
|
|
const directory = new URL("../deploy/ack/", import.meta.url);
|
|
const files = readdirSync(directory).filter((name) => name.endsWith(".yaml")).sort();
|
|
|
|
for (const file of files) {
|
|
const text = readFileSync(new URL(file, directory), "utf8");
|
|
assert(text.includes("apiVersion:"), `${file}: missing apiVersion`);
|
|
assert(text.includes("kind:"), `${file}: missing kind`);
|
|
assert(!text.includes("server-snippet"), `${file}: must not depend on disabled snippet annotations`);
|
|
}
|
|
|
|
const migrationJob = read("migration-job.yaml");
|
|
assert(migrationJob.includes("name: ZHINIAN_DATA_BACKEND\n value: postgres"), "migration Job must select postgres");
|
|
assert(migrationJob.includes("name: DATABASE_APP_ROLE"), "migration Job must provision the Web role");
|
|
assert(migrationJob.includes("secretName: zhinian-rds-ca"), "migration Job must mount the RDS CA");
|
|
|
|
const web = read("web.yaml");
|
|
assert(/^\s*replicas: 1\s*$/m.test(web), "Web must default to one replica until object storage is shared");
|
|
assert(web.includes("path: /api/ready"), "Web must use database-aware readiness");
|
|
|
|
const ingress = read("ingress.yaml");
|
|
assert(ingress.includes("path: /api/internal/worker"), "Ingress must intercept the internal worker prefix");
|
|
assert(ingress.includes("name: zhinian-public-deny"), "Ingress must route the internal prefix away from Web");
|
|
|
|
const service = read("service.yaml");
|
|
assert(service.includes("name: zhinian-public-deny"), "selectorless deny Service is required");
|
|
|
|
console.log(`ACK manifest assertions passed (${files.length} files)`);
|
|
|
|
function read(file) {
|
|
return readFileSync(new URL(file, directory), "utf8");
|
|
}
|
|
|
|
function assert(condition, message) {
|
|
if (!condition) throw new Error(message);
|
|
}
|