Initial curated projectbrain source from 8a7b1e0651dbdab97d744cbd2e653ab3970ac6c5
This commit is contained in:
commit
5aa3e8d685
700 files changed
+132801
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { compareDeploymentCommits, isRunningContainer } from "./deployment-proof-state.mjs";
|
||||
|
||||
test("missing identities cannot be reported as current", () => {
|
||||
for (const value of ["unknown", "", undefined, "not-a-sha"]) {
|
||||
assert.equal(compareDeploymentCommits(value, value), "unknown");
|
||||
assert.equal(compareDeploymentCommits("9deb553", value), "unknown");
|
||||
}
|
||||
});
|
||||
test("known revisions compare exactly", () => {
|
||||
assert.equal(compareDeploymentCommits("9deb553", "9DEB553"), "current");
|
||||
assert.equal(compareDeploymentCommits("9deb553", "a415d3f"), "stale");
|
||||
});
|
||||
test("frontend evidence must belong to its own running container", () => {
|
||||
const output = "projectbrain-frontend Exited 1\nother Up 1 hour 0.0.0.0:1209->80/tcp";
|
||||
assert.equal(isRunningContainer(output, "projectbrain-frontend", "1209->80/tcp"), false);
|
||||
});
|
||||
test("reject similarly named or unhealthy containers", () => {
|
||||
for (const row of ["projectbrain-api-old Up 1 hour", "projectbrain-api Up 1 hour (unhealthy)", "projectbrain-api Up 2 seconds (health: starting)"]) {
|
||||
assert.equal(isRunningContainer(row, "projectbrain-api"), false);
|
||||
}
|
||||
});
|
||||
test("accept exact running containers with matching ports", () => {
|
||||
assert.equal(isRunningContainer("projectbrain-frontend Up 1 hour (healthy) 0.0.0.0:1209->80/tcp\r\n", "projectbrain-frontend", "1209->80/tcp"), true);
|
||||
assert.equal(isRunningContainer("projectbrain-api Up 1 hour", "projectbrain-api"), true);
|
||||
});
|
||||
Reference in new issue
Block a user