Docker images / prepare-release (push) Successful in 11s
Docker images / backend-test (push) Successful in 10m21s
Docker images / frontend-image (push) Successful in 2m8s
Docker images / updater-image (push) Successful in 38s
Docker images / netflow-agent-image (push) Successful in 32s
Docker images / backend-image (push) Successful in 1m59s
Docker images / publish-release (push) Successful in 12s
Docker images / notify-webhook (push) Successful in 2s
44 lines
3.5 KiB
TypeScript
44 lines
3.5 KiB
TypeScript
import assert from "node:assert/strict"
|
|
import { test } from "node:test"
|
|
import { createHash } from "node:crypto"
|
|
import { MIGRATION_MANIFEST, migrationManifestDigest } from "../../src/db/migration-manifest.js"
|
|
import { ixWriterProfileEnrollmentSql } from "../../src/db/internet-exchange-writer-profile.js"
|
|
import { approvedDefinition } from "./catalogue.mjs"
|
|
import { FIXED58_ROLE_TEMPLATE } from "./fixed58-build-definition.js"
|
|
import { BUILD59_PROVENANCE, FIXED59_ROLE_TEMPLATE } from "./fixed59-build-definition.js"
|
|
import { BUILD60_PROVENANCE, FIXED60_ROLE_TEMPLATE } from "./fixed60-build-definition.js"
|
|
import { catalogueTopologyPolicy } from "./expanded44-data-policy.js"
|
|
|
|
test("source59 pins migration 0058 and alters only the IX catalogue and its existing servers references", () => {
|
|
assert.equal(BUILD59_PROVENANCE.manifestSha256, createHash("sha256").update(JSON.stringify(MIGRATION_MANIFEST.slice(0, 58))).digest("hex"))
|
|
assert.equal(catalogueTopologyPolicy(59).baseRelations, catalogueTopologyPolicy(58).baseRelations + 3)
|
|
const added = new Set(FIXED59_ROLE_TEMPLATE.tables.filter(row => String(row.relname).startsWith("ix_segment")).map(row => row.relname))
|
|
assert.deepEqual([...added].sort(), ["ix_segment_devices", "ix_segment_revisions", "ix_segments"])
|
|
for (const group of ["tables", "columns", "roleGrants", "inheritance", "indexes"]) {
|
|
assert.deepEqual(FIXED59_ROLE_TEMPLATE[group].filter(row => !added.has(row.relname)), FIXED58_ROLE_TEMPLATE[group])
|
|
}
|
|
assert.equal(FIXED59_ROLE_TEMPLATE.triggers.length - FIXED58_ROLE_TEMPLATE.triggers.length, 21)
|
|
assert.equal(FIXED59_ROLE_TEMPLATE.constraints.length - FIXED58_ROLE_TEMPLATE.constraints.length, 24)
|
|
})
|
|
|
|
test("source60 changes poll storage constraints without changing writer grants or table topology", () => {
|
|
assert.equal(BUILD60_PROVENANCE.manifestSha256, migrationManifestDigest())
|
|
const approval = { format: "application-writer-source60-definition-approval-v1", provenance: BUILD60_PROVENANCE, template: FIXED60_ROLE_TEMPLATE }
|
|
assert.equal(approvedDefinition(approval).definitionSha256, BUILD60_PROVENANCE.templateSha256)
|
|
assert.deepEqual(FIXED60_ROLE_TEMPLATE.tables, FIXED59_ROLE_TEMPLATE.tables)
|
|
assert.deepEqual(FIXED60_ROLE_TEMPLATE.roleGrants, FIXED59_ROLE_TEMPLATE.roleGrants)
|
|
assert.equal(catalogueTopologyPolicy(60).baseRows.constraints, catalogueTopologyPolicy(59).baseRows.constraints - 1)
|
|
})
|
|
|
|
test("source59 accepts the exact independently reviewed definition and restricts IX runtime grants", () => {
|
|
const approval = { format: "application-writer-source59-definition-approval-v1", provenance: BUILD59_PROVENANCE, template: FIXED59_ROLE_TEMPLATE }
|
|
assert.equal(approvedDefinition(approval).definitionSha256, BUILD59_PROVENANCE.templateSha256)
|
|
assert.throws(() => approvedDefinition({ ...approval, template: FIXED58_ROLE_TEMPLATE }))
|
|
const granted = FIXED59_ROLE_TEMPLATE.roleGrants.filter(row => row.rolname === "@mm-role:runtime@" && String(row.relname).startsWith("ix_"))
|
|
assert(granted.every(row => row.read === true && row.insert === true && row.truncate === false))
|
|
assert.deepEqual(granted.filter(row => row.update === true).map(row => row.relname), ["ix_segments"])
|
|
assert.deepEqual(granted.filter(row => row.delete === true).map(row => row.relname), ["ix_segment_devices"])
|
|
assert.match(ixWriterProfileEnrollmentSql("ix_runtime", "ix_capture"), /GRANT SELECT, INSERT ON TABLE public.ix_segment_revisions TO "ix_runtime"/)
|
|
assert.throws(() => ixWriterProfileEnrollmentSql('bad"role', "ix_capture"))
|
|
})
|