Skip to content

Conversation

WesleyRosenblum
Copy link
Contributor

@WesleyRosenblum WesleyRosenblum commented Jul 16, 2025

Resolved issues:

resolves #2694

Description of changes:

Moves the integration tests from the s2n-quic crate to a new s2n-quic-tests crate and adds a README.md describing the test structure and how to run them.

Call-outs:

The s2n-quic-tls feature flag was previously used to gate the resumption tests based on if the s2n-tls provider was enabled (which it is on unix-based systems). This feature is only defined in the s2n-quic crate (implicitly through the inclusion of an optional s2n-quic-tls dependency. I had trouble utilizing the same feature flag in the new s2n-quic-tests crate, so instead I'm using cfg[unix] to more explicitly gate the compilation of the resumption tests to unix-based systems.

Testing:

Verified successful test count before and after migration:

CI Run Before Count After Count
test (stable, ubuntu-latest, native) 83 83
test (stable, macOS-latest, native) 83 83
test (stable, windows-latest, native) 55 55
test (beta, ubuntu-latest, native) 83 83
test (beta, macOS-latest, native) 83 83
test (beta, windows-latest, native) 55 55
test (1.82.0, ubuntu-latest, native) 83 83
test (1.82.0, macOS-latest, native) 83 83
test (1.82.0, windows-latest, native) 55 55
test (stable, ubuntu-latest, aarch64-unknown-linux-gnu) 83 83
test (stable, ubuntu-latest, i686-unknown-linux-gnu) 82 82
test (stable, ubuntu-latest, x86_64-unknown-linux-musl) 83 83

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

@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just continue to put the tests in src/tests.rs? IIRC it should be faster to compile since you don't have to compile and link the intermediate s2n-quic-tests lib.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I started out by following the test organization guidance in the Rust book: https://doc.rust-lang.org/book/ch11-03-test-organization.html, but then I came across this blog post which was showing how they organize it in the Cargo repository. So I decided to just pattern it off of Cargo

I did try it just now though and it was actually slower (though that might just be my CPU doing something else at the same time).

Copy link
Contributor

Choose a reason for hiding this comment

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

Right. That post mentions exactly what I'm talking about:

For an internal library, I avoid integration tests all together. Instead, I use Cargo unit tests for “integration” bits:

src/
 lib.rs
 tests.rs
 tests/
   foo.rs
   bar.rs

That way, I avoid linking the separate integration tests binary altogether. I also have access to non-pub API of the crate, which is often useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah I remember seeing that, but I was getting hung up on "internal library". I guess in this case the library is s2n-quic-tests, which is internal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've moved them back to src and updated the readme to include the reasoning

@boquan-fang boquan-fang self-requested a review July 16, 2025 20:49
@WesleyRosenblum WesleyRosenblum merged commit 6b9e7bf into main Jul 16, 2025
132 checks passed
@WesleyRosenblum WesleyRosenblum deleted the WesleyRosenblum/testrefactor branch July 16, 2025 22:12
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.

Move All Integration Tests to a s2n-quic-tests crate
3 participants