Add multi-decoder split and pit timing support
This commit is contained in:
@@ -87,6 +87,40 @@ test("SQLite API persists state, passings, and overlay session results", { timeo
|
||||
assert.equal(health.ok, true);
|
||||
assert.equal(health.dbPath, join(dataDir, "rc_timing.sqlite"));
|
||||
|
||||
const ammcConfigResponse = await fetch(`${baseUrl}/api/ammc/config`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
managedEnabled: true,
|
||||
decoderHost: "192.168.1.10",
|
||||
wsPort: 9000,
|
||||
splitEnabled: true,
|
||||
splitDecoderHost: "192.168.1.11",
|
||||
splitWsPort: 9001,
|
||||
pitEnabled: true,
|
||||
pitEntryDecoderHost: "192.168.1.12",
|
||||
pitEntryWsPort: 9002,
|
||||
pitExitDecoderHost: "192.168.1.13",
|
||||
pitExitWsPort: 9003,
|
||||
}),
|
||||
});
|
||||
const ammcConfigPayload = await ammcConfigResponse.json();
|
||||
assert.equal(ammcConfigResponse.status, 200);
|
||||
assert.equal(ammcConfigPayload.config.splitWsPort, 9001);
|
||||
assert.equal(ammcConfigPayload.config.pitExitDecoderHost, "192.168.1.13");
|
||||
assert.equal(ammcConfigPayload.status.role, "main");
|
||||
assert.equal(ammcConfigPayload.status.split.role, "split");
|
||||
assert.equal(ammcConfigPayload.status.pitEntry.wsPort, 9002);
|
||||
|
||||
const duplicatePortResponse = await fetch(`${baseUrl}/api/ammc/config`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ splitEnabled: true, splitWsPort: 9000 }),
|
||||
});
|
||||
const duplicatePortPayload = await duplicatePortResponse.json();
|
||||
assert.equal(duplicatePortResponse.status, 400);
|
||||
assert.match(duplicatePortPayload.error, /unique WebSocket port/);
|
||||
|
||||
const emptyResponse = await fetch(`${baseUrl}/api/state`);
|
||||
assert.deepEqual(await emptyResponse.json(), { state: null, updatedAt: null });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user