fix: isolate production migration database URL
This commit is contained in:
@@ -8,10 +8,27 @@ import test from "node:test";
|
||||
import { parse as parseYaml } from "yaml";
|
||||
|
||||
import { configString } from "./src/gitops-render/core.mjs";
|
||||
import { opencodeEgressProxyUrlForProfile } from "./src/gitops-render/runtime-manifests.mjs";
|
||||
import { externalPostgresConfigForLane, externalPostgresManifest, opencodeEgressProxyUrlForProfile } from "./src/gitops-render/runtime-manifests.mjs";
|
||||
|
||||
import { CLOUD_CORE_MIGRATIONS, CLOUD_TRANSACTIONAL_REALTIME_MIGRATION_ID } from "../internal/db/schema.ts";
|
||||
|
||||
test("production migration uses its YAML-declared database Secret key", async () => {
|
||||
const deploy = parseYaml(await readFile("deploy/deploy.yaml", "utf8"));
|
||||
const config = externalPostgresConfigForLane(deploy, "production", { nodeId: "NC01" });
|
||||
const manifest = externalPostgresManifest({
|
||||
profile: "production",
|
||||
config,
|
||||
source: { full: "a".repeat(40), short: "a".repeat(12), imageTag: "a".repeat(12) },
|
||||
deploy,
|
||||
migrationSources: [{ path: "0001_test.sql", sql: "select 1;" }]
|
||||
});
|
||||
const job = manifest.items.find((item) => item.kind === "Job");
|
||||
assert.deepEqual(job?.spec?.template?.spec?.containers?.[0]?.env?.[0]?.valueFrom?.secretKeyRef, {
|
||||
name: "hwlab-cloud-api-production-db",
|
||||
key: "migration-database-url"
|
||||
});
|
||||
});
|
||||
|
||||
function taskByName(pipeline, name) {
|
||||
const task = pipeline.spec.tasks.find((item) => item.name === name);
|
||||
assert.ok(task, `missing task ${name}`);
|
||||
|
||||
Reference in New Issue
Block a user