Просмотр исходного кода

test: wait for ports to be released instead of a fixed 3s CI sleep

stop() slept for 3s on CI after every suite, which adds up to over two
minutes per run. The sleep was added when stop() did not wait for the
process to exit; it now waits for close (with a SIGKILL fallback). Replace
the sleep with a wait until the frontend and Prometheus ports refuse
connections, failing after 10s if they are still held.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesread 21 часов назад
Родитель
Сommit
b2d75caa7f
1 измененных файлов с 7 добавлено и 6 удалено
  1. 7 6
      integration-tests/runner.mjs

+ 7 - 6
integration-tests/runner.mjs

@@ -136,12 +136,13 @@ class OliveTinTestRunnerStartLocalProcess extends OliveTinTestRunner {
 
 
     this.ot = null
     this.ot = null
 
 
-    if (process.env.CI === 'true') {
-      // GitHub runners seem to need a bit more time to clean up
-      await new Promise((res) => setTimeout(res, 3000))
-    } else {
-      await new Promise((res) => setTimeout(res, 50))
-    }
+    // The next suite binds the same ports, so wait until they are released
+    // rather than sleeping for a guessed amount of time.
+    await waitOn({
+      resources: ['tcp:127.0.0.1:1337', 'tcp:127.0.0.1:1341'],
+      reverse: true,
+      timeout: 10000,
+    })
   }
   }
 }
 }