Skip to content

chore: swarm executor should match runtime in tests#6024

Merged
mergify[bot] merged 10 commits intolibp2p:masterfrom
elenaf9:fix/swarm-executor-in-tests
May 27, 2025
Merged

chore: swarm executor should match runtime in tests#6024
mergify[bot] merged 10 commits intolibp2p:masterfrom
elenaf9:fix/swarm-executor-in-tests

Conversation

@elenaf9
Copy link
Member

@elenaf9 elenaf9 commented May 18, 2025

Description

We've changed most of our tests to use the tokio runtime: #4449.
All of these tests, however, were using swarm_test::Swarm::new_ephemeral, which actually creates a Swarm with async_std executor.

This PR changes all test that are using tokio as runtime to use swarm_test::Swarm::new_ephemeral_tokio, so that the executor used by the swarm matches the test's executor.

It also defaults swarm-test to the tokio feature.

Notes & open questions

It also defaults swarm-test to the tokio feature.

Done to prevent that in future PRs and tests Swarm::new_ephemeral is accidentally used again. Crates will need to explicitly enable the async-std feature if they actually want to use that executor.

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
  • A changelog entry has been made in the appropriate crates

@elenaf9 elenaf9 changed the title fix: swarm executor should match runtime in tests chore: swarm executor should match runtime in tests May 22, 2025
@elenaf9 elenaf9 force-pushed the fix/swarm-executor-in-tests branch from 2df7e87 to eed59a9 Compare May 22, 2025 09:41
Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

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

Thanks for this Elena! LGTM
We could probably also make the Swarm::new_ephemeral use tokio by default in a subsequent PR, wdyt Elena?

@jxs jxs added the send-it label May 27, 2025
@mergify mergify bot merged commit cd215dc into libp2p:master May 27, 2025
71 checks passed
mergify bot pushed a commit that referenced this pull request Jun 18, 2025
Amendment to #5857.
#5857 changed the tests in `libp2p-request-response` to use `tokio` as executor.
We forgot to also change the test-swarm's executor to use `tokio` instead of `async_std` (see #6024), so this PR fixes it.

Pull-Request: #6063.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants