Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
test: ipv6 tests can be skipped if unsupported
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Jul 19, 2023
1 parent 8fe974e commit 3c1c52c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {
})
const serverAddr = defer()
const serverAddr6 = defer()
const disableIp6 = process.env.DISABLE_IPV6 != null

server.stdout.on('data', (buf) => {
const data = buf.toString()
Expand All @@ -43,11 +44,13 @@ export default {
}
})


return {
server,
env: {
serverAddr: await serverAddr.promise,
serverAddr6: await serverAddr6.promise
serverAddr6: disableIp6 === false ? await serverAddr6.promise : 'skipping',
disableIp6
}
}
},
Expand Down
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributing

## Running tests

Run `npm run test`.

### Running tests without IPv6

If you try to run these tests locally, and your machine does not support IPv6,
the tests will hang waiting on an ip6 address from the
`go-libp2p-webtransport-server`.

To get around this, you can set the environment variable `DISABLE_IPV6` to `true`
to prevent those tests from running. e.g. `DISABLE_IPV6=true npm run test`
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,5 @@ Licensed under either of
## Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

See the [Contributing](./CONTRIBUTING.md) doc for details on developing changes to this repo.
5 changes: 4 additions & 1 deletion test/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ describe('libp2p-webtransport', () => {
await node.stop()
})

it('connects to ipv6 addresses', async () => {
it('connects to ipv6 addresses', async function () {
if (process.env.disableIp6 === 'true') {
return this.skip()
}
if (process.env.serverAddr6 == null) {
throw new Error('serverAddr6 not found')
}
Expand Down

0 comments on commit 3c1c52c

Please sign in to comment.