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

feat: add experimental turmoil IO provider and example #1663

Merged
merged 3 commits into from
Mar 29, 2023

Conversation

camshaft
Copy link
Contributor

@camshaft camshaft commented Mar 11, 2023

Description of changes:

This change adds an experimental IO provider for turmoil. This allows applications to inject latency and faults into packet transmission and make assertions about behavior.

I've added an example of how an application might use the s2n-quic API to perform this kind of testing.

Testing:

I added a test for the provider, similar to the tokio provider tests. The example can also be executed and show that it correctly integrates.

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

@camshaft camshaft force-pushed the camshaft/turmoil-provider branch from 475d954 to 1c608ba Compare March 13, 2023 17:39
@camshaft camshaft marked this pull request as ready for review March 13, 2023 18:17
Copy link

@mcches mcches left a comment

Choose a reason for hiding this comment

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

Lgtm!

examples/turmoil-provider/src/lib.rs Outdated Show resolved Hide resolved
@@ -0,0 +1,467 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copy link

Choose a reason for hiding this comment

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

This seems like a great starting point, but it would be great to fill the gaps so we just have tokio io and we can swap turmoil::net for tokio::net and it just works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The trickiest part (and why I didn't end up using the tokio provider) is we use some libc syscalls with raw FDs that you wouldn't be able to intercept. But if tokio had an API that reported to us if it was inside of a simulation or not, we could avoid those paths at runtime and have it Just Work™ for applications.

@camshaft camshaft force-pushed the camshaft/turmoil-provider branch from 139b959 to cc2f939 Compare March 29, 2023 18:54
@camshaft camshaft force-pushed the camshaft/turmoil-provider branch from cc2f939 to b72defd Compare March 29, 2023 19:11
@camshaft camshaft merged commit 1ab3385 into main Mar 29, 2023
@camshaft camshaft deleted the camshaft/turmoil-provider branch March 29, 2023 19:49
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