-
Notifications
You must be signed in to change notification settings - Fork 47
Add shuttle-tokio #238
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
base: main
Are you sure you want to change the base?
Add shuttle-tokio #238
Conversation
jorajeev
left a comment
There was a problem hiding this 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" } |
There was a problem hiding this comment.
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?
wrappers/tokio/README.md
Outdated
| @@ -0,0 +1,34 @@ | |||
| # ShuttleTokio | |||
There was a problem hiding this comment.
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`
wrappers/tokio/README.md
Outdated
| @@ -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. | |||
There was a problem hiding this comment.
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.
wrappers/tokio/README.md
Outdated
|
|
||
| ## How to use | ||
|
|
||
| To use it, do something akin to the following in your Cargo.toml: |
There was a problem hiding this comment.
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.
wrappers/tokio/README.md
Outdated
|
|
||
| ## 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the complete list,see https://github.com/tokio-rs/tokio/blob/master/tokio/Cargo.toml#L29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're linking to the wrong crate, see https://github.com/tokio-rs/tokio/blob/master/tokio-stream/Cargo.toml#L22
| @@ -0,0 +1,6 @@ | |||
| # ShuttleTokioStream | |||
There was a problem hiding this comment.
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: | |||
There was a problem hiding this comment.
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`]. |
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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; | |||
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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?
Co-authored-by: Rajeev Joshi <jorajeev@amazon.com> Co-authored-by: Bernhard Kragl <kraglb@amazon.com>
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.