Unify §3 test overlaps (todo §3); fold the 5× image-pin checks into one compose.test.ts scan + same-version sidecar test, drop the duplicate committed-JWKS re-validation in config.test.ts

This commit is contained in:
2026-06-17 17:07:39 +02:00
parent 360449e76b
commit fcf042fa66
7 changed files with 41 additions and 74 deletions
+4 -14
View File
@@ -1,8 +1,7 @@
// Guards the Ory Hydra config (§3): image pinned to an exact version (AGENTS.md),
// migrations run before the server (hydra-migrate → hydra), the DSN targets the hydra
// database, the server listens on the public/admin ports, and the issuer +
// login/consent/logout URLs point at our app. Real boot is verified by running the
// stack; this catches edits.
// Guards the Ory Hydra config (§3): migrations run before the server (hydra-migrate →
// hydra), the DSN targets the hydra database, the server listens on the public/admin
// ports, and the issuer + login/consent/logout URLs point at our app. Version pinning is
// in compose.test.ts. Real boot is verified by running the stack; this catches edits.
import { test } from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
@@ -11,15 +10,6 @@ const read = (p: string) => readFileSync(new URL(`../${p}`, import.meta.url), "u
const compose = read("compose.yml");
const hydraYml = read("ory/hydra/hydra.yml");
test("compose pins both hydra services to one exact version", () => {
const tags = [...compose.matchAll(/image:\s*oryd\/hydra:(\S+)/g)].map((m) => m[1]);
assert.equal(tags.length, 2, "hydra + hydra-migrate both present");
assert.equal(tags[0], tags[1], "both pinned to the same version");
const tag = tags[0]!;
assert.match(tag, /^v\d+\.\d+\.\d+$/, `${tag} is an exact vMAJOR.MINOR.PATCH`);
assert.doesNotMatch(tag, /latest|[\^~*]/, `${tag} is exact, not floating`);
});
test("hydra migrations run once before the server starts", () => {
assert.ok((compose.match(/migrate sql -e --yes/g) ?? []).length >= 2,
"hydra-migrate runs SQL migrations (alongside kratos)");