From 3c1c52cbd91e0031055237e898f2a8ab3a5a55d1 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 19 Jul 2023 15:24:40 -0700 Subject: [PATCH] test: ipv6 tests can be skipped if unsupported --- .aegir.js | 5 ++++- CONTRIBUTING.md | 14 ++++++++++++++ README.md | 2 ++ test/browser.ts | 5 ++++- 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/.aegir.js b/.aegir.js index a31c770..847a567 100644 --- a/.aegir.js +++ b/.aegir.js @@ -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() @@ -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 } } }, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..defc24e --- /dev/null +++ b/CONTRIBUTING.md @@ -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` diff --git a/README.md b/README.md index 59fca5c..d55c573 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/test/browser.ts b/test/browser.ts index 153743e..2f04c78 100644 --- a/test/browser.ts +++ b/test/browser.ts @@ -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') }