rust-libp2p/interop-tests
Marco Munizaga 4c889fd6d5
fix(interop): install wasm-opt in Dockerfile.chromium
I'm not able to build this container on my machine arm64 linux because the builder is missing the `wasm-opt` binary. I'm not sure why CI manages to do so. I'm guessing the x86 image is slightly different and may include `wasm-opt`.

This makes a change to that dockerfile to explicitly install `wasm-opt`.

Here's the previous error:


```
// ...
#0 36.90     Finished release [optimized] target(s) in 35.97s
#0 36.91   Installing /root/.cache/.wasm-pack/.wasm-bindgen-cargo-install-0.2.87/bin/wasm-bindgen
#0 36.91   Installing /root/.cache/.wasm-pack/.wasm-bindgen-cargo-install-0.2.87/bin/wasm-bindgen-test-runner
#0 36.91   Installing /root/.cache/.wasm-pack/.wasm-bindgen-cargo-install-0.2.87/bin/wasm2es6js
#0 36.91    Installed package `wasm-bindgen-cli v0.2.87` (executables `wasm-bindgen`, `wasm-bindgen-test-runner`, `wasm2es6js`)
#0 37.06 warning: be sure to add `/root/.cache/.wasm-pack/.wasm-bindgen-cargo-install-0.2.87/bin` to your PATH to be able to run the installed binaries
#0 37.22 Error: no prebuilt wasm-opt binaries are available for this platform: Unrecognized target!
#0 37.22 To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
#0 37.22 Caused by: no prebuilt wasm-opt binaries are available for this platform: Unrecognized target!
#0 37.22 To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
------
ERROR: failed to solve: executor failed running [/bin/sh -c wasm-pack build --target web interop-tests]: exit code: 1
```

Another solution would be to diable wasm-opt as mentioned in the error message as well.

Pull-Request: #4192.
2023-07-13 04:53:24 +00:00
..

Interop tests implementation

This folder defines the implementation for the interop tests.

Running this test locally

You can run this test locally by having a local Redis instance and by having another peer that this test can dial or listen for. For example to test that we can dial/listen for ourselves we can do the following:

  1. Start redis (needed by the tests): docker run --rm -it -p 6379:6379 redis/redis-stack.
  2. In one terminal run the dialer: redis_addr=localhost:6379 ip="0.0.0.0" transport=quic-v1 security=quic muxer=quic is_dialer="true" cargo run --bin ping
  3. In another terminal, run the listener: redis_addr=localhost:6379 ip="0.0.0.0" transport=quic-v1 security=quic muxer=quic is_dialer="false" cargo run --bin native_ping

To test the interop with other versions do something similar, except replace one of these nodes with the other version's interop test.

Running this test with webtransport dialer in browser

To run the webtransport test from within the browser, you'll need the chromedriver in your $PATH, compatible with your Chrome browser. Firefox is not yet supported as it doesn't support all required features yet (in v114 there is no support for certhashes).

  1. Build the wasm package: wasm-pack build --target web
  2. Run the dialer: redis_addr=127.0.0.1:6379 ip=0.0.0.0 transport=webtransport is_dialer=true cargo run --bin wasm_ping

Running all interop tests locally with Compose

To run this test against all released libp2p versions you'll need to have the (libp2p/test-plans)[https://github.com/libp2p/test-plans] checked out. Then do the following (from the root directory of this repository):

  1. Build the image: docker build -t rust-libp2p-head . -f interop-tests/Dockerfile.
  2. Build the images for all released versions in libp2p/test-plans: (cd <path to >/libp2p/test-plans/multidim-interop/ && make).
  3. Run the test:
RUST_LIBP2P="$PWD"; (cd <path to >/libp2p/test-plans/multidim-interop/ && npm run test -- --extra-version=$RUST_LIBP2P/interop-tests/ping-version.json --name-filter="rust-libp2p-head")