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

Use of Shuttle for Rust async and #[tokio::main] #134

Open
cameronelliott opened this issue Feb 16, 2024 · 1 comment
Open

Use of Shuttle for Rust async and #[tokio::main] #134

cameronelliott opened this issue Feb 16, 2024 · 1 comment

Comments

@cameronelliott
Copy link

Hi, I am very interested in what Shuttle brings to the table for testing.
As far as I can tell it is mostly designed for Rust sync code without #[tokio::main] main setups.

But I am a bit confused by the presences of the shuttle::future module.
I am guessing it's really for sync programs which are invoking a little bit of async code?

It seems like if Shuttle was intended for testing mostly async programs, there would
be replacement implementations for stuff like tokio::sync::Mutex (An asynchronous Mutex-like type).

Anyway I'd like to get some feedback about the suitability of Shuttle for testing mostly async functions and code.

Thank you. And thank you for creating Shuttle.

@jorajeev
Copy link
Member

Shuttle does support checking async code; for instance you can find examples of checking code with mpsc channels from the futures crate in our tests.

To support code using libraries like tokio, there are two options: (1) recompile tokio code using Shuttle primitives (which, as you can imagine, is a lot of work and hard to maintain long-term), or (2) write your own replacements for tokio primitives in Shuttle (similar to how we've written replacements for std::sync primitives in the shuttle::sync module). We've done some early work on (2), but don't have anything ready to publish at the moment.

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

No branches or pull requests

2 participants