Skip to content

Commit e664d14

Browse files
test: ipv6 tests can be skipped if unsupported (#1885)
Co-authored-by: Alex Potsides <[email protected]>
1 parent 11a394c commit e664d14

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

packages/transport-webtransport/.aegir.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default {
2727
})
2828
const serverAddr = defer()
2929
const serverAddr6 = defer()
30+
const disableIp6 = process.env.DISABLE_IPV6 != null
3031

3132
server.stdout.on('data', (buf) => {
3233
const data = buf.toString()
@@ -47,7 +48,8 @@ export default {
4748
server,
4849
env: {
4950
serverAddr: await serverAddr.promise,
50-
serverAddr6: await serverAddr6.promise
51+
serverAddr6: disableIp6 === false ? await serverAddr6.promise : 'skipping',
52+
disableIp6
5153
}
5254
}
5355
},
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Contributing
2+
3+
## Running tests
4+
5+
Run `npm run test`.
6+
7+
### Running tests without IPv6
8+
9+
If you try to run these tests locally, and your machine does not support IPv6,
10+
the tests will hang waiting on an ip6 address from the
11+
`go-libp2p-webtransport-server`.
12+
13+
To get around this, you can set the environment variable `DISABLE_IPV6` to `true`
14+
to prevent those tests from running. e.g. `DISABLE_IPV6=true npm run test`

packages/transport-webtransport/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,5 @@ Licensed under either of
9191
## Contribution
9292

9393
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.
94+
95+
See the [Contributing](./CONTRIBUTING.md) doc for details on developing changes to this repo.

packages/transport-webtransport/test/browser.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ describe('libp2p-webtransport', () => {
101101
await node.stop()
102102
})
103103

104-
it('connects to ipv6 addresses', async () => {
104+
it('connects to ipv6 addresses', async function () {
105+
if (process.env.disableIp6 === 'true') {
106+
return this.skip()
107+
}
105108
if (process.env.serverAddr6 == null) {
106109
throw new Error('serverAddr6 not found')
107110
}

0 commit comments

Comments
 (0)