diff --git a/.github/workflows/chain-endpoints.yml b/.github/workflows/chain-endpoints.yml index 58b25df4b5..f262dd8d20 100644 --- a/.github/workflows/chain-endpoints.yml +++ b/.github/workflows/chain-endpoints.yml @@ -4,7 +4,7 @@ on: - cron: '50 0/12 * * *' jobs: - types: + endpoints: if: github.repository == 'polkadot-js/apps' runs-on: ubuntu-latest steps: diff --git a/packages/apps-config/src/ci/chainEndpoints.spec.ts b/packages/apps-config/src/ci/chainEndpoints.spec.ts index 7706cfc6e9..946446f350 100644 --- a/packages/apps-config/src/ci/chainEndpoints.spec.ts +++ b/packages/apps-config/src/ci/chainEndpoints.spec.ts @@ -19,6 +19,10 @@ interface DnsResponse { const TIMEOUT = 60_000; +function noopHandler () { + // ignore +} + describe('check endpoints', (): void => { const checks = createWsEndpoints() .filter(({ isDisabled, isUnreachable, value }) => @@ -39,34 +43,34 @@ describe('check endpoints', (): void => { let websocket: WebSocket | null = null; afterEach((): void => { + completed++; + if (websocket) { - websocket.onclose = null; - websocket.onerror = null; - websocket.onopen = null; - websocket.onmessage = null; + websocket.onclose = noopHandler; + websocket.onerror = noopHandler; + websocket.onopen = noopHandler; + websocket.onmessage = noopHandler; try { websocket.close(); - } catch { - // ignore + } catch (e) { + console.error((e as Error).message); } websocket = null; } - completed++; - if (completed === checks.length) { process.exit(errored); } }); for (const { name, ws: endpoint } of checks) { - it(`${name} @ ${endpoint}`, async (): Promise => { + it(`${name} @ ${endpoint}`, async (): Promise => { const [,, hostWithPort] = endpoint.split('/'); const [host] = hostWithPort.split(':'); - return fetchJson(`https://dns.google/resolve?name=${host}`) + await fetchJson(`https://dns.google/resolve?name=${host}`) .then((json) => assert(json && json.Answer, 'No DNS entry') )