This commit is contained in:
@@ -32,7 +32,8 @@ test("running duplicate is authoritative and historical folder is never linked",
|
||||
const historical = workload("portfolio-old", { running: false, root: "/mnt/user/appdata/portfolio/releases/old", link: { profileId: "profile-old", repositoryFullName: "Jens/Portfolio" } });
|
||||
const result = classifyInventory([historical, active], [{ id: "profile", environment: "production" }, { id: "profile-old", environment: "production" }]);
|
||||
assert.equal(result.find((item) => item.workloadId === "portfolio-current").authoritative, true);
|
||||
assert.equal(result.find((item) => item.workloadId === "portfolio-old").classification.type, "duplicate");
|
||||
assert.equal(result.find((item) => item.workloadId === "portfolio-old").classification.type, "backup");
|
||||
assert.equal(result.find((item) => item.workloadId === "portfolio-old").shadowedLink.profileId, "profile-old");
|
||||
assert.equal(result.find((item) => item.workloadId === "portfolio-old").link, null);
|
||||
});
|
||||
|
||||
@@ -40,9 +41,11 @@ for (const [label, item, expected] of [
|
||||
["backup Compose folder", workload("backup", { root: "/mnt/user/appdata/portfolio-backup", running: false }), "backup"],
|
||||
["release directory", workload("release", { root: "/mnt/user/appdata/portfolio/releases/a1", running: false }), "release-folder"],
|
||||
["staging workload", workload("stage", { root: "/mnt/user/appdata/portfolio-staging" }), "staging"],
|
||||
["candidate runtime", workload("candidate", { name: "portfolio-candidate-039" }), "temporary-runtime"],
|
||||
["stopped legitimate app", workload("stopped", { running: false }), "stopped-application"],
|
||||
["Compose without container", workload("historical", { noContainers: true, running: false }), "historical-compose"],
|
||||
["container without repository", workload("orphan", { remote: "", candidates: [], status: "unmatched" }), "orphan-container"],
|
||||
["external container without Git provenance", workload("external", { remote: "", candidates: [], status: "unmatched" }), "external-container"],
|
||||
["external container with inaccessible repository provenance", workload("external-git", { remote: "https://github.com/vendor/image.git", candidates: [], status: "unmatched" }), "external-container"],
|
||||
["system container", workload("infra", { name: "watchtower", remote: "", candidates: [] }), "system-container"],
|
||||
["ambiguous exact matches", workload("ambiguous", { status: "ambiguous", candidates: [{ repositoryFullName: "Jens/A", score: 100, exact: true }, { repositoryFullName: "Jens/B", score: 100, exact: true }] }), "ambiguous"],
|
||||
["profile whose server workload disappeared", { ...workload("stale", { running: false, noContainers: true, link: { profileId: "profile-stale", repositoryFullName: "Jens/Portfolio" } }), metadata: { sourceRepository: "git@gitea.test:Jens/Portfolio.git", branch: "main", staleLink: true } }, "stale-link"],
|
||||
@@ -75,7 +78,7 @@ test("review decisions drive classification and explicit authority", () => {
|
||||
{ workloadId: secondary.workloadId, evidenceHash: secondary.evidenceHash, action: "select-authoritative", reason: "Verified production instance" },
|
||||
];
|
||||
const result = classifyInventory([workload("primary"), workload("secondary")], [], decisions);
|
||||
assert.equal(result.find((item) => item.workloadId === "primary").classification.type, "duplicate");
|
||||
assert.equal(result.find((item) => item.workloadId === "primary").classification.type, "historical-compose");
|
||||
assert.equal(result.find((item) => item.workloadId === "secondary").authoritative, true);
|
||||
});
|
||||
|
||||
|
||||
@@ -104,14 +104,12 @@ test("corrupt configuration is recoverable from the migration backup", async (t)
|
||||
assert.equal(JSON.parse(await readFile(harness.paths.config, "utf8")).version, "0.10.0");
|
||||
});
|
||||
|
||||
test("release verification rejects checksum, signer, timestamp, missing asset and drafts", async (t) => {
|
||||
test("release verification rejects checksum failures, missing assets and drafts without requiring paid signing", async (t) => {
|
||||
const harness = await fixture(t);
|
||||
await harness.publishRelease("1.0.0-ok");
|
||||
assert.equal((await harness.verifyRelease("1.0.0-ok")).verified, true);
|
||||
for (const [version, options, error] of [
|
||||
["1.0.0-checksum", { badChecksum: true }, /checksum/],
|
||||
["1.0.0-signer", { signer: "CN=Wrong" }, /signer/],
|
||||
["1.0.0-time", { timestamped: false }, /timestamp/],
|
||||
["1.0.0-missing", { missingAsset: true }, /asset is missing/],
|
||||
["1.0.0-draft", { draft: true }, /draft release/],
|
||||
]) {
|
||||
|
||||
Reference in New Issue
Block a user