Skip to content

Conversation

@sarsko
Copy link
Contributor

@sarsko sarsko commented Dec 2, 2025

Adds shuttle-tokio implementation and wrappers.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Member

@jorajeev jorajeev left a comment

Choose a reason for hiding this comment

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

Only reviewed upto tokio-stream

]

[dependencies]
tokio = { package = "shuttle-tokio", version = "VERSION_NUMBER" }
Copy link
Member

Choose a reason for hiding this comment

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

We should just have users depend on * right?

@@ -0,0 +1,34 @@
# ShuttleTokio
Copy link
Member

Choose a reason for hiding this comment

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

Let's avoid introducing the term ShuttleTokio which is not really meaningful to anyone. Change this heading to:

# Shuttle support for `tokio`

@@ -0,0 +1,34 @@
# ShuttleTokio

This folder contains the implementation and wrapper for ShuttleTokio, which provides [tokio](https://crates.io/crates/tokio) support to Shuttle.
Copy link
Member

Choose a reason for hiding this comment

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

replace with

This folder contains the implementation and wrapper that enables testing of [tokio](https://crates.io/crates/tokio) applications with Shuttle.


## How to use

To use it, do something akin to the following in your Cargo.toml:
Copy link
Member

Choose a reason for hiding this comment

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

Replace do something akin to the following to add the following.


## Limitations

The development of ShuttleTokio has come as a consequence of teams at Amazon needing support for model checking code using tokio. What has driven development is the functionality needed by these teams, meaning there are parts of tokio which have not been implemented or which have not been modeled faithfully. This is something to keep in mind if you want to use ShuttleTokio, and there is some likelihood that there will be functionality that will need to be added. We are happy to review PRs if there is functionality you'd like to add to ShuttleTokio.
Copy link
Member

Choose a reason for hiding this comment

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

Replace this with:

Shuttle's tokio support does not currently model all tokio functionality. Some parts of tokio have not been implemented or may not be modeled faithfully. Keep this in mind when using Shuttle with tokio, as you may encounter missing functionality that needs to be added. If you encounter missing features, please file an issue or, better yet, open a PR to contribute the functionality.


/// Always fails with the error message below.
/// ```text
/// The #[shuttle_tokio::main] macro requires rt or rt-multi-thread.
Copy link
Member

Choose a reason for hiding this comment

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

Both here (and in similar uses below), will the error say [shuttle_tokio::main] and not [tokio::main] ?

[features]
default = ["time"]

full = [
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,6 @@
# ShuttleTokioStream
Copy link
Member

Choose a reason for hiding this comment

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

Change to # Shuttle support for tokio-stream

@@ -0,0 +1,6 @@
# ShuttleTokioStream

This package was made by doing the following:
Copy link
Member

Choose a reason for hiding this comment

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

Rewrite this as

This package was derived from tokio-stream by:
1. Cloning the original repository
2. Replacing the tokio dependency with Shuttle's tokio implementation in Cargo.toml
3. Removing extraneous files and dependencies (docs, fuzz tests, CHANGELOG.md, etc.)

attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
))]

//! This is the "impl" crate implementing [`tokio-stream`] support for [`Shuttle`].
Copy link
Member

Choose a reason for hiding this comment

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

Please rephrase this as per my comments in PR #232

@@ -0,0 +1,173 @@
// Rate limiter test demonstrating a subtle concurrency bug that Shuttle can catch
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not fully clear to me why this lives here

@@ -0,0 +1,144 @@
use shuttle::future::block_on;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This does not belong in tokio-test

}

#[tokio_orig::test]
async fn test_async_connection_limit_traditional() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do we have a tokio test?

sarsko and others added 3 commits January 13, 2026 02:16
Co-authored-by: Rajeev Joshi <jorajeev@amazon.com>
Co-authored-by: Bernhard Kragl <kraglb@amazon.com>
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.

2 participants