@norskvideo/ctl-test-harness 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/studio-state.js +11 -3
package/package.json
CHANGED
package/studio-state.js
CHANGED
|
@@ -15,8 +15,16 @@
|
|
|
15
15
|
// fetchers). Extracted verbatim from the playout copy — the canonical text.
|
|
16
16
|
// Commentary's WHIP-driver tail (RemoteCommentary*, discoverCommentaryWhipUrls,
|
|
17
17
|
// assertCommentaryChannelOccupied) stays local to commentary.
|
|
18
|
+
// The host the studio port is reachable on. Normally the product template
|
|
19
|
+
// publishes it on the loopback of the machine running the tests, so localhost is
|
|
20
|
+
// right. When the test process itself runs inside a container that launches the
|
|
21
|
+
// studio as a HOST sibling (docker-outside-of-docker CI — e.g. the jankings
|
|
22
|
+
// runners), the published port lives on the host, reachable via the host-gateway
|
|
23
|
+
// alias: set NORSK_TEST_HOST=host.docker.internal there. Daemon-port fetches are
|
|
24
|
+
// deliberately left on localhost — the daemon runs in-process with the tests.
|
|
25
|
+
const STUDIO_HOST = process.env.NORSK_TEST_HOST ?? "localhost";
|
|
18
26
|
export async function fetchComponents(studioHostPort) {
|
|
19
|
-
const r = await fetch(`http
|
|
27
|
+
const r = await fetch(`http://${STUDIO_HOST}:${studioHostPort}/live/api/components`, {
|
|
20
28
|
signal: AbortSignal.timeout(5000),
|
|
21
29
|
});
|
|
22
30
|
if (r.status === 503)
|
|
@@ -26,7 +34,7 @@ export async function fetchComponents(studioHostPort) {
|
|
|
26
34
|
return (await r.json());
|
|
27
35
|
}
|
|
28
36
|
export async function fetchComponentState(studioHostPort, componentId) {
|
|
29
|
-
const r = await fetch(`http
|
|
37
|
+
const r = await fetch(`http://${STUDIO_HOST}:${studioHostPort}/live/api/${encodeURIComponent(componentId)}/state`, {
|
|
30
38
|
signal: AbortSignal.timeout(5000),
|
|
31
39
|
});
|
|
32
40
|
if (r.status === 503 || r.status === 404)
|
|
@@ -42,7 +50,7 @@ export function isSrtListenerState(value) {
|
|
|
42
50
|
return Array.isArray(v.connectedStreams) && typeof v.connectedAt === "object" && v.connectedAt !== null;
|
|
43
51
|
}
|
|
44
52
|
async function fetchComponentStreamRoute(studioHostPort, componentId, route) {
|
|
45
|
-
const r = await fetch(`http
|
|
53
|
+
const r = await fetch(`http://${STUDIO_HOST}:${studioHostPort}/live/api/${encodeURIComponent(componentId)}/streams/${route}`, { signal: AbortSignal.timeout(5000) });
|
|
46
54
|
if (r.status === 503 || r.status === 404)
|
|
47
55
|
return null;
|
|
48
56
|
if (!r.ok)
|