From 34f688ffe5ef3d8b1e1507d264c871f78a9a0104 Mon Sep 17 00:00:00 2001 From: web3-bot <81333946+web3-bot@users.noreply.github.com> Date: Tue, 6 Dec 2022 10:19:19 +0100 Subject: [PATCH] sync: update CI config files (#232) * update .github/workflows/js-test-and-release.yml * test: fix tests on node 18 (#234) We need to specify the host name to connect. If we don't it defaults to `localhost` - it seems in node 17+ DNS resolution has changed to return IPv6 addresses by default which causes the connection to fail because the listener has only bound to an IPv4 address. Co-authored-by: web3-bot Co-authored-by: Alex Potsides --- .github/workflows/js-test-and-release.yml | 2 +- test/max-connections.spec.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index ed173493d9..c6897e3b53 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -27,7 +27,7 @@ jobs: strategy: matrix: os: [windows-latest, ubuntu-latest, macos-latest] - node: [16] + node: [lts/*] fail-fast: true steps: - uses: actions/checkout@v3 diff --git a/test/max-connections.spec.ts b/test/max-connections.spec.ts index 19f4bbf6c1..24551a0a8b 100644 --- a/test/max-connections.spec.ts +++ b/test/max-connections.spec.ts @@ -18,10 +18,10 @@ describe('maxConnections', () => { const port = 9900 const seenRemoteConnections = new Set() - const trasnport = tcp({ maxConnections })() + const transport = tcp({ maxConnections })() const upgrader = mockUpgrader() - const listener = trasnport.createListener({ upgrader }) + const listener = transport.createListener({ upgrader }) // eslint-disable-next-line @typescript-eslint/promise-function-async afterEachCallbacks.push(() => listener.close()) await listener.listen(multiaddr(`/ip4/127.0.0.1/tcp/${port}`)) @@ -33,7 +33,7 @@ describe('maxConnections', () => { const sockets: net.Socket[] = [] for (let i = 0; i < socketCount; i++) { - const socket = net.connect({ port }) + const socket = net.connect({ host: '127.0.0.1', port }) sockets.push(socket) // eslint-disable-next-line @typescript-eslint/promise-function-async