MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / preflight

Function preflight

apps/api/e2e/lib.ts:190–209  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

188}
189
190export async function preflight() {
191 scenario('preflight');
192 const api = await fetch(`${API_URL}/`)
193 .then((r) => r.ok || r.status === 404)
194 .catch(() => false);
195 check(`api reachable at ${API_URL}`, !!api);
196 const worker = await fetch(`${WORKER_URL}/debug/cron`)
197 .then((r) => r.ok)
198 .catch(() => false);
199 check(`worker debug reachable at ${WORKER_URL}`, !!worker);
200 if (!api || !worker) {
201 throw new Error('Stack not reachable — start it with `pnpm dev` first.');
202 }
203 if (SESSION_TIMEOUT_MS > 60_000) {
204 console.warn(
205 `\n⚠ SESSION_TIMEOUT_MS=${SESSION_TIMEOUT_MS}ms — this run will be slow.\n` +
206 ' Re-run the stack AND the harness with e.g. SESSION_TIMEOUT_MS=4000.'
207 );
208 }
209}
210
211/** Run `fn` over `items` with at most `concurrency` in flight. */
212export async function runPool<T>(

Callers 2

mainFunction · 0.90
mainFunction · 0.90

Calls 6

scenarioFunction · 0.85
checkFunction · 0.70
fetchFunction · 0.50
catchMethod · 0.45
thenMethod · 0.45
warnMethod · 0.45

Tested by

no test coverage detected