Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(webtransport): Add interop-tests support with wasm #4063

Closed
wants to merge 39 commits into from

Conversation

zvolin
Copy link
Contributor

@zvolin zvolin commented Jun 12, 2023

Description

Add interop tests for webtransport backend. The test is built as a wasm package and executed in headless chrome instance using webdriver.

Related #4015.

Notes & open questions

I've tested this both locally and from within the docker image versus the go-libp2p ping implementation.

This still needs to be picked up in https://github.com/libp2p/test-plans/blob/master/multidim-interop/versions.ts

I'm not sure how should I modify the ping-version.json file.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works (this itself is a test)
  • A changelog entry has been made in the appropriate crates (changelog added in @oblique PR's)

@mergify

This comment was marked as resolved.

@zvolin zvolin changed the title chore(webtransport-websys): Add interop-tests support for webtransport in wasm chore(webtransport): Add interop-tests support with wasm Jun 12, 2023
@zvolin zvolin force-pushed the webtransport-interop-tests branch from 47baa5f to 8c26133 Compare June 12, 2023 12:37
@thomaseizinger thomaseizinger changed the base branch from master to webtransport-wasm-ext June 12, 2023 15:15
@thomaseizinger
Copy link
Contributor

I've retargeted this to a copy of the original PR that now lives on a branch in this repository so we can stack the PRs on top of each other.

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this! Very high quality!

I made a few comments. Overall, I think it will be better to stick to one binary and have a conditionally-compiled run_test function.

interop-tests/src/bin/wasm_ping.rs Outdated Show resolved Hide resolved
interop-tests/src/bin/wasm_ping.rs Outdated Show resolved Hide resolved
interop-tests/src/bin/wasm_ping.rs Outdated Show resolved Hide resolved
interop-tests/src/bin/wasm_ping.rs Outdated Show resolved Hide resolved
interop-tests/src/compat.rs Outdated Show resolved Hide resolved
interop-tests/Dockerfile.chromium Outdated Show resolved Hide resolved
interop-tests/Dockerfile.chromium Outdated Show resolved Hide resolved
interop-tests/src/bin/wasm_ping.rs Outdated Show resolved Hide resolved
interop-tests/Cargo.toml Outdated Show resolved Hide resolved
interop-tests/Cargo.toml Outdated Show resolved Hide resolved
@thomaseizinger
Copy link
Contributor

thomaseizinger commented Jun 12, 2023

This still needs to be picked up in libp2p/test-plans@master/multidim-interop/versions.ts

It will be with the next release, nothing to be done here for now.

I'm not sure how should I modify the ping-version.json file.

We will have to make a copy of that and modify our CI to also build the 2nd docker image and run the tests for that. We can simply append more steps to this job here:

- name: Build image
run: docker buildx build --load -t rust-libp2p-head . -f interop-tests/Dockerfile
- uses: libp2p/test-plans/.github/actions/run-interop-ping-test@master
with:
test-filter: rust-libp2p-head
extra-versions: ${{ github.workspace }}/interop-tests/ping-version.json
s3-cache-bucket: libp2p-by-tf-aws-bootstrap
s3-access-key-id: ${{ vars.TEST_PLANS_BUILD_CACHE_KEY_ID }}
s3-secret-access-key: ${{ secrets.TEST_PLANS_BUILD_CACHE_KEY }}

I'd suggest sticking to the same "native" vs "wasm" naming.

@thomaseizinger
Copy link
Contributor

thomaseizinger commented Jun 12, 2023

Overall, my suggestion would be that we iterate on the tests in here and once we are happy, we merge them into #4065 and then merge the implementation plus test together into master as a single PR.

@thomaseizinger
Copy link
Contributor

I am not quite sure why CI isn't running but I think it should run as soon as you push a new commit.

@zvolin zvolin force-pushed the webtransport-interop-tests branch from 8c26133 to 5e1149a Compare June 12, 2023 16:19
@zvolin zvolin force-pushed the webtransport-interop-tests branch from 5e1149a to 05bf0d3 Compare June 12, 2023 16:19
@thomaseizinger thomaseizinger changed the base branch from webtransport-wasm-ext to master June 13, 2023 07:52
@mergify
Copy link
Contributor

mergify bot commented Jun 13, 2023

This pull request has merge conflicts. Could you please resolve them @zvolin? 🙏

@thomaseizinger
Copy link
Contributor

@zvolin Would you mind opening a PR against https://github.com/oblique/rust-libp2p/tree/webtransport-wasm-ext instead? Then we can merge this PR into that branch once we have a passing interop-test.

@oblique Can you please enable GitHub actions on your fork?

@thomaseizinger
Copy link
Contributor

Also, I'd prefer if you didn't force-push commits. It doesn't play well with GitHub's review system and we squash-merge anyway in here, thanks :)

@zvolin
Copy link
Contributor Author

zvolin commented Jun 13, 2023

@zvolin Would you mind opening a PR against https://github.com/oblique/rust-libp2p/tree/webtransport-wasm-ext instead? Then we can merge this PR into that branch once we have a passing interop-test.

As agreed I've opened the PR vs @oblique branch, however I'd like to first resolve all the things there to not cut off the discussion 👍

@thomaseizinger
Copy link
Contributor

@zvolin Would you mind opening a PR against https://github.com/oblique/rust-libp2p/tree/webtransport-wasm-ext instead? Then we can merge this PR into that branch once we have a passing interop-test.

As agreed I've opened the PR vs @oblique branch, however I'd like to first resolve all the things there to not cut off the discussion 👍

Sounds good to me, I should have time for another review pass today!

@oblique
Copy link
Contributor

oblique commented Jun 14, 2023

@thomaseizinger Do you use self hosted runners for this repo? In my fork we are getting failure on webrtc interop tests and I was wondering if a self hosted runner is the solution to it. Can you run the CI for this PR once?

This is the error:

  Error: Command failed: docker compose -f /tmp/compose-runner/native-rust-libp2p-head-x-rust-v0-51-0--webrtc-direct-/compose.yaml up --exit-code-from=dialer --renew-anon-volumes
   redis Pulling 
   redis Error 
  Error response from daemon: received unexpected HTTP status: 500 Internal Server Error
  
      at ChildProcess.exithandler (node:child_process:419:12)
      at ChildProcess.emit (node:events:513:28)
      at ChildProcess.emit (node:domain:489:12)
      at maybeClose (node:internal/child_process:1091:16)
      at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
    code: 18,
    killed: false,
    signal: null,
    cmd: 'docker compose -f /tmp/compose-runner/native-rust-libp2p-head-x-rust-v0-51-0--webrtc-direct-/compose.yaml up --exit-code-from=dialer --renew-anon-volumes',
    stdout: '',
    stderr: ' redis Pulling \n' +
      ' redis Error \n' +
      'Error response from daemon: received unexpected HTTP status: 500 Internal Server Error\n'
  },

@zvolin zvolin force-pushed the webtransport-interop-tests branch from a31c792 to 0eeb124 Compare June 14, 2023 09:27
@zvolin
Copy link
Contributor Author

zvolin commented Jun 14, 2023

This is the error:

I debugged this case locally and it seems that we have to start listener even if the node is a dialing one. Hidden it behind the cfg so that's not the case for wasm, but I think the latter cfg must stay in this case to not depend on id variable. Will play around this tho to see if we can do any cleaner

@thomaseizinger
Copy link
Contributor

@thomaseizinger Do you use self hosted runners for this repo?

We do but they are simply more powerful machines on AWS without any specific configuration.

Can you run the CI for this PR once?

CI doesn't currently run because there are merge conflicts and we use pull_request as the trigger for all workflows.

This is the error:

I debugged this case locally and it seems that we have to start listener even if the node is a dialing one. Hidden it behind the cfg so that's not the case for wasm, but I think the latter cfg must stay in this case to not depend on id variable. Will play around this tho to see if we can do any cleaner

Does my suggestion here help?

Also note that the error is for the WebRTC transport, not the newly added WebTransport so it should be unrelated.

interop-tests/src/lib.rs Outdated Show resolved Hide resolved
interop-tests/src/lib.rs Outdated Show resolved Hide resolved
interop-tests/src/bin/wasm_ping.rs Show resolved Hide resolved
interop-tests/src/bin/wasm_ping.rs Show resolved Hide resolved
interop-tests/src/lib.rs Show resolved Hide resolved
Comment on lines 103 to 108
tokio::spawn(async move {
loop {
swarm.next().await;
}
});
tokio::time::sleep(test_timeout).await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, we'd have to move the Swarm::listen_on into the match arm where is_dialer is false.

@zvolin
Copy link
Contributor Author

zvolin commented Jun 14, 2023

@thomaseizinger So with 0eeb124 the native interop tests are working.
We are now experiencing no space left on device when this job proceeds to the chromium tests. @oblique is suggesting to either split it to 2 separate jobs or cleanup docker images after the native one finishes. I'm not personally fan of the latter and you suggested to keep those as a single job, so not sure how to tackle this

@zvolin
Copy link
Contributor Author

zvolin commented Jun 14, 2023

we could also have a superjob that depends on the 2 jobs if you want to have a single required job

@thomaseizinger
Copy link
Contributor

@thomaseizinger So with 0eeb124 the native interop tests are working. We are now experiencing no space left on device when this job proceeds to the chromium tests. @oblique is suggesting to either split it to 2 separate jobs or cleanup docker images after the native one finishes. I'm not personally fan of the latter and you suggested to keep those as a single job, so not sure how to tackle this

Yeah agreed, happy to go back to two jobs. Probably better anyway because otherwise it is going to be a super long CI job.

@zvolin
Copy link
Contributor Author

zvolin commented Jun 14, 2023

seems stuck 🤔

@thomaseizinger
Copy link
Contributor

seems stuck thinking

They are not, see https://github.com/libp2p/rust-libp2p/actions/runs/5267580644. But using a matrix changes the name of the job so we will have to adjust that before merging it. GitHub is listing it because it is a required check.

@zvolin
Copy link
Contributor Author

zvolin commented Jun 14, 2023

Thanks for the review 👍
I'm closing this in favor of oblique#1 now

@zvolin zvolin closed this Jun 14, 2023
@thomaseizinger
Copy link
Contributor

thomaseizinger commented Jun 14, 2023

I've got two more follow-up commits so I am gonna quickly re-open to push those :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants