23 lines
1.4 KiB
TypeScript
23 lines
1.4 KiB
TypeScript
import assert from "node:assert/strict"
|
|
import { basename,dirname,resolve } from "node:path"
|
|
|
|
// Standalone private harness admission precedes all configured pool/runtime
|
|
// imports. This profile never runs against an existing application database.
|
|
assert.equal(process.env.MMAPP_OWN_COLLECTOR_PARTITION_WRITERS,"true")
|
|
const database=new URL(process.env.DATABASE_URL??"")
|
|
assert.equal(database.hostname,"127.0.0.1");assert.equal(database.pathname,"/postgres")
|
|
assert(["postgres:","postgresql:"].includes(database.protocol))
|
|
assert(process.env.MCP_STATE_DIR&&basename(dirname(resolve(process.env.MCP_STATE_DIR))).startsWith("mm-mcp-test-"))
|
|
const {pool,closePool}=await import("../db/index.js")
|
|
try{
|
|
assert.equal((await pool.query("SELECT current_database() AS name")).rows[0].name,"postgres")
|
|
const {applySqlMigrations}=await import("../db/migrate.js")
|
|
await applySqlMigrations(pool)
|
|
const {acceptCollectorPartitionWritesSql}=await import("./collector-partition-writes.sql-helper.js")
|
|
const result=await acceptCollectorPartitionWritesSql()
|
|
assert.equal(result.cases,28)
|
|
assert.equal((await pool.query("SELECT count(*)::int AS n FROM servers WHERE enabled=true")).rows[0].n,0)
|
|
assert.equal((await pool.query("SELECT count(*)::int AS n FROM uptime_probes WHERE enabled=true")).rows[0].n,0)
|
|
console.log("Actual collector writer/application FK acceptance:",JSON.stringify(result))
|
|
}finally{await closePool()}
|