diff --git a/scripts/lib/deploy-smoke-display.mjs b/scripts/lib/deploy-smoke-display.mjs index 1291faa..f888afb 100644 --- a/scripts/lib/deploy-smoke-display.mjs +++ b/scripts/lib/deploy-smoke-display.mjs @@ -435,14 +435,22 @@ async function seedSignage(owner) { context.fillStyle = ${JSON.stringify(colour)}; context.fillRect(0, 0, 640, 360); const blob = await new Promise((resolve) => canvas.toBlob(resolve, "image/png")); - const response = await fetch(${JSON.stringify(`${apiOrigin}${base}/images?filename=slide-${index}.png&displayName=Slide%20${index}`)}, { + return fetch(${JSON.stringify(`${apiOrigin}${base}/images?filename=slide-${index}.png&displayName=Slide%20${index}`)}, { body: blob, credentials: "include", headers: { "content-type": "image/png" }, method: "POST", signal: AbortSignal.timeout(${requestTimeoutMs}), - }); - return { status: response.status, body: await response.json().catch(() => null) }; + }).then( + async (response) => ({ status: response.status, body: await response.json().catch(() => null) }), + (error) => ({ status: error && error.name === "TimeoutError" ? "timeout" : "network-error" }), + ); })()`, `uploading slide ${index}`, ); + if (uploaded.status === "timeout") { + throw new HangError(`HTTP POST ${base}/images from page "owner"`, requestTimeoutMs); + } + if (uploaded.status !== 200 && uploaded.status !== 201) { + throw new Error(`Uploading slide ${index} returned HTTP ${uploaded.status}.`); + } images.push(uploaded.body?.image?.id); } check( diff --git a/scripts/smoke-deploy.sh b/scripts/smoke-deploy.sh index a7bc73d..7e311fc 100755 --- a/scripts/smoke-deploy.sh +++ b/scripts/smoke-deploy.sh @@ -659,6 +659,7 @@ if [[ "$topology" == split ]]; then --network "$edge_network" \ -e SMOKE_CDP_ADDRESS="${browser_address}:9222" \ -e SMOKE_KIOSK_CDP_ADDRESS="${kiosk_address}:9222" \ + -e SMOKE_CALL_TIMEOUT_MS="${EKKLESIA_SMOKE_CALL_TIMEOUT_MS:-30000}" \ -e SMOKE_STEP_BUDGET_MS="$((budget * 1000))" \ -e SMOKE_WATCH_MS="${EKKLESIA_SMOKE_WATCH_MS:-120000}" \ -e SMOKE_RECYCLE_WATCH_MS="${EKKLESIA_SMOKE_RECYCLE_WATCH_MS:-330000}" \ diff --git a/tests/ci-scripts.test.ts b/tests/ci-scripts.test.ts index 4130fd7..33439b9 100644 --- a/tests/ci-scripts.test.ts +++ b/tests/ci-scripts.test.ts @@ -235,6 +235,12 @@ describe("CI scripts on a shared Docker daemon", () => { expect(deploy).toContain("the restored display runtime did not return with its data"); }); + it("gives page-side display requests enough time on a constrained shared runner", async () => { + const deploy = await source("scripts/smoke-deploy.sh"); + expect(deploy).toContain('-e SMOKE_CALL_TIMEOUT_MS="'); + expect(deploy).toContain("EKKLESIA_SMOKE_CALL_TIMEOUT_MS:-30000"); + }); + it("run every deploy smoke against the one generic image, never a second image with a module in it", async () => { // ADR 0048: the split topology installs its test module into module storage at run time. const deploy = (await source("scripts/smoke-deploy.sh")).replace(/\\\n\s*/gu, " ");