45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { existsSync, readFileSync } from "node:fs";
|
|
|
|
function readExistingSource(relativePath) {
|
|
const sourceUrl = new URL(relativePath, import.meta.url);
|
|
if (!existsSync(sourceUrl)) {
|
|
return "";
|
|
}
|
|
|
|
return readFileSync(sourceUrl, "utf8");
|
|
}
|
|
|
|
function readExistingSources(relativePaths) {
|
|
return relativePaths
|
|
.map((relativePath) => readExistingSource(relativePath))
|
|
.filter(Boolean)
|
|
.join("\n");
|
|
}
|
|
|
|
const composeSource = readExistingSources([
|
|
"../../../docker-compose.yml",
|
|
"../../../docker-compose.prod.yml",
|
|
]);
|
|
const traefikSource = readExistingSources([
|
|
"../../../services/traefik/traefik.yml",
|
|
"../../../services/traefik/traefik.prod.yml",
|
|
]);
|
|
|
|
test("traefik does not expose a dedicated public edge broker port", () => {
|
|
assert.doesNotMatch(traefikSource, /edge-broker:\s*\n\s*address:\s*":4300"/);
|
|
assert.doesNotMatch(composeSource, /ports:[\s\S]*"4300:4300"/);
|
|
});
|
|
|
|
test("the docker stack no longer defines an edge broker websocket service", () => {
|
|
assert.doesNotMatch(composeSource, /\bedge-broker:\b/);
|
|
assert.doesNotMatch(composeSource, /\/ws\/agent/);
|
|
assert.doesNotMatch(composeSource, /\/ws\/browser-shell/);
|
|
});
|
|
|
|
test("php services no longer receive broker websocket environment defaults", () => {
|
|
assert.doesNotMatch(composeSource, /EDGE_BROKER_URL/);
|
|
assert.doesNotMatch(composeSource, /EDGE_BROKER_SHARED_SECRET/);
|
|
});
|