27 lines
1.7 KiB
JavaScript
27 lines
1.7 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
|
|
const composeSource = readFileSync(new URL("../../../docker-compose.yml", import.meta.url), "utf8");
|
|
const traefikSource = readFileSync(new URL("../../../services/traefik/traefik.yml", import.meta.url), "utf8");
|
|
const traefikProdSource = readFileSync(new URL("../../../services/traefik/traefik.prod.yml", import.meta.url), "utf8");
|
|
|
|
test("traefik exposes a dedicated edge broker entrypoint on port 4300", () => {
|
|
assert.match(traefikSource, /edge-broker:\s*\n\s*address:\s*":4300"/);
|
|
assert.match(traefikProdSource, /edge-broker:\s*\n\s*address:\s*":4300"/);
|
|
assert.match(composeSource, /traefik:[\s\S]*ports:[\s\S]*"4300:4300"/);
|
|
});
|
|
|
|
test("edge broker is routed through traefik on port 4300 for public api hosts", () => {
|
|
assert.match(composeSource, /edge-broker:[\s\S]*traefik\.http\.routers\.edge-broker-dk\.entrypoints=edge-broker/);
|
|
assert.match(composeSource, /edge-broker:[\s\S]*traefik\.http\.routers\.edge-broker-io\.entrypoints=edge-broker/);
|
|
assert.match(composeSource, /edge-broker:[\s\S]*traefik\.http\.services\.edge-broker\.loadbalancer\.server\.port=4300/);
|
|
});
|
|
|
|
test("php services receive the broker url and shared secret defaults", () => {
|
|
assert.match(composeSource, /php1:[\s\S]*EDGE_BROKER_URL:\s*\$\{EDGE_BROKER_URL:-http:\/\/edge-broker:4300\}/);
|
|
assert.match(composeSource, /php1:[\s\S]*EDGE_BROKER_SHARED_SECRET:\s*\$\{EDGE_BROKER_SHARED_SECRET:-truckwash-edge-dev\}/);
|
|
assert.match(composeSource, /php-staging:[\s\S]*EDGE_BROKER_URL:\s*\$\{EDGE_BROKER_URL:-http:\/\/edge-broker:4300\}/);
|
|
assert.match(composeSource, /php-cron:[\s\S]*EDGE_BROKER_SHARED_SECRET:\s*\$\{EDGE_BROKER_SHARED_SECRET:-truckwash-edge-dev\}/);
|
|
});
|