Skip to content

Commit

Permalink
sync: update CI config files (libp2p#232)
Browse files Browse the repository at this point in the history
* update .github/workflows/js-test-and-release.yml

* test: fix tests on node 18 (libp2p#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 <[email protected]>
Co-authored-by: Alex Potsides <[email protected]>
  • Loading branch information
3 people authored Dec 6, 2022
1 parent 609c9b8 commit 34f688f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/js-test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/max-connections.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ describe('maxConnections', () => {
const port = 9900

const seenRemoteConnections = new Set<string>()
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}`))
Expand All @@ -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
Expand Down

0 comments on commit 34f688f

Please sign in to comment.