fix(tests): use global tokio runtime for tests [NR-520774]#2163
Draft
fix(tests): use global tokio runtime for tests [NR-520774]#2163
Conversation
Contributor
Author
|
There is something else 😓
I'll look into it! |
Contributor
Author
|
Reproducible locally with enough repetitions ❯ for i in {1..50}; do echo "=== Run $i ===" && cargo test --package newrelic_agent_control --lib -- --skip on_host 2>&1 || break; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This PR introduces a global helper to initialize the
tokioruntime on unit tests. Additionally, it updates the HTTP Status Server shutdown: now it tries to stop both the server and the event-consumer even if the first stop operation fails.Notes for reviewers
The
#[serial]macro wasn't actually needed in the HTTP Status Server tests (it has been removed in this PR). When removingserialthe test became more flaky and the issue was easy to reproduce using:❯ for i in {1..15}; do echo "=== Run $i ===" && cargo test --package newrelic_agent_control --lib http_server::runner::tests 2>&1 || break; doneWe already had a global helper for integration tests although it wasn't used everywhere (the corresponding integration tests are also updated in this PR). Considering the
tokioruntime documentation and the fact of that we use a single runtime in Agent Control code, it seems the right path to follow.