From 28324e5d330088f538f4e7879ed0df29d2c88fd6 Mon Sep 17 00:00:00 2001 From: Domi Date: Tue, 23 Apr 2024 16:27:19 +0200 Subject: [PATCH] [TT-1001] Loosen Runtime CI assumptions on devtools behavior (#10499) --- .../e2e-tests/scripts/buildkite_run_fe_tests.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/e2e-tests/scripts/buildkite_run_fe_tests.ts b/packages/e2e-tests/scripts/buildkite_run_fe_tests.ts index f30e7c7c20d..04d44d9e045 100644 --- a/packages/e2e-tests/scripts/buildkite_run_fe_tests.ts +++ b/packages/e2e-tests/scripts/buildkite_run_fe_tests.ts @@ -142,17 +142,16 @@ function githubUrlToRepository(url) { return url?.replace(/.*github.com[:\/](.*)\.git/, "$1"); } -function waitForHTTPStatus( +function testHttpConnection( url: string, - statusCode: number = 200, // by default we wait for OK - timeoutMs = 15000, // keep waiting for 15s total - retryTime = 1000 // retry after 1s + timeoutMs = 15000 // keep waiting for 15s total ): Promise { const startTime = Date.now(); return new Promise((resolve, reject) => { function attemptConnection() { - const request = http.get(url, res => { - if (res.statusCode === statusCode) { + const request = http.get(url, async res => { + if (res.statusCode < 500) { + // As long as we can connect at all, we should be fine. resolve(); return; } @@ -259,7 +258,7 @@ export default async function run_fe_tests( // make sure the dev server is up and running. console.log("waiting for dev server to start up"); - await waitForHTTPStatus("http://localhost:8080/"); + await testHttpConnection("http://localhost:8080/"); console.log("dev server up, continuing with test"); }