The five beds that read the catalogue read it through the harness
adopted-store-cross-node, two-node-db and the three whole-mesh beds each carried a private loader; they drifted. The ace loader never resolved a runtime artifact, so a module the mesh builds travelled unresolved; whole-mesh-full still asked for 'registry' and 'firewall', which the catalogue names distribution and nftables, and swallowed the miss as NOT ASSIGNED. One loader now (novox/hq 04-ISSUES/073).
This commit is contained in:
@@ -37,13 +37,12 @@
|
||||
|
||||
import { test, before, after } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { existsSync } from "node:fs";
|
||||
import { loadScenario } from "../../src/declaration/parse.ts";
|
||||
import { raise } from "../../src/lifecycle/raise.ts";
|
||||
import { destroy, exec } from "../../src/lifecycle/operate.ts";
|
||||
import { hostBinaryPath, HOST_PATH } from "../../src/lifecycle/place.ts";
|
||||
import { labIsUsable, destroyAll, foundationBundle, onTheMachine } from "./harness.ts";
|
||||
import { labIsUsable, destroyAll, foundationBundle, onTheMachine, catalogueIsPresent, catalogueModule, needsBrokerAccount } from "./harness.ts";
|
||||
import type { HeldImage } from "../../src/pinning.ts";
|
||||
|
||||
const capability = await labIsUsable();
|
||||
@@ -56,16 +55,13 @@ const skip = !capability.usable
|
||||
? "MESH_LAB_HOST_BINARY is not set to a built mesh-host"
|
||||
: !bundle || !existsSync(bundle)
|
||||
? "MESH_LAB_BUNDLE is not set to a foundation bundle (mesh-host examples/)"
|
||||
: false;
|
||||
: catalogueIsPresent();
|
||||
|
||||
const SCENARIO = "two-node-db";
|
||||
/** The node that carries the whole DB-consumer chain. anchor carries only the foundation. */
|
||||
const NODE = "laptop";
|
||||
|
||||
const modulesEnv = process.env["MESH_LAB_MODULES"] ?? "";
|
||||
const catalogDir = process.env["MESH_LAB_CATALOG"]
|
||||
?? (modulesEnv ? resolve(dirname(dirname(dirname(modulesEnv))), "mesh-catalog", "modules") : "")
|
||||
?? resolve(process.cwd(), "..", "mesh-catalog", "modules");
|
||||
|
||||
|
||||
let instanceId = "";
|
||||
/** The mesh's own images, as the machines hold them. */
|
||||
@@ -359,22 +355,11 @@ test("consumers on a joined node get their databases from the one foundation sto
|
||||
await mesh(`assign ${NODE} ${name}`);
|
||||
}
|
||||
|
||||
// Load a committed catalog module.json with its container images rewritten to this scenario's
|
||||
// pinned digests, so the foundation store can be ADOPTED in place as the one postgres.
|
||||
// The catalogue's manifest as the lab runs it (harness), so the foundation store can be ADOPTED
|
||||
// in place as the one postgres.
|
||||
function loadManifest(name: string): { manifest: string; broker: boolean } {
|
||||
const m = JSON.parse(readFileSync(resolve(catalogDir, name, "module.json"), "utf8")) as {
|
||||
resources?: { type: string; image?: string; artifact?: string }[];
|
||||
};
|
||||
for (const r of m.resources ?? []) {
|
||||
if (r.type !== "container") continue;
|
||||
if (typeof r.image === "string") r.image = pinned(r.image);
|
||||
else if (typeof r.artifact === "string") {
|
||||
r.image = pinned(`mesh-runtime-${name}@sha256:${"0".repeat(64)}`);
|
||||
delete r.artifact;
|
||||
}
|
||||
}
|
||||
const manifest = JSON.stringify(m);
|
||||
return { manifest, broker: manifest.includes("MESH_BROKER_FILE") };
|
||||
const manifest = catalogueModule(name, held);
|
||||
return { manifest, broker: needsBrokerAccount(manifest) };
|
||||
}
|
||||
async function installCatalog(name: string, node: string): Promise<void> {
|
||||
const { manifest, broker } = loadManifest(name);
|
||||
|
||||
Reference in New Issue
Block a user