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

tests: print traces from tests #479

Merged
merged 2 commits into from
Oct 28, 2020
Merged

tests: print traces from tests #479

merged 2 commits into from
Oct 28, 2020

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Oct 27, 2020

In order to make debugging test failures easier, it's helpful to print
the traces emitted by the code being tested.

This branch enables traces in tests by creating a
tracing_subscriber::fmt subscriber and setting it as the default for
each test. We set with_test_writer(true) so that the subscriber's log
output can participate in libtest's output capturing; the logs from each
test are only printed if that test fails. I changed all the tests to
ensure that the #[tokio::test] macro creates a current-thread runtime
so that the default subscriber is set for all tasks in the test.

hawkw added 2 commits October 27, 2020 12:15
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
@LucioFranco LucioFranco merged commit 069c908 into master Oct 28, 2020
@LucioFranco LucioFranco deleted the eliza/trace-tests branch October 28, 2020 15:40
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