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

cleanup(otel): tests use scoped span catcher #12097

Merged
merged 3 commits into from
Jul 14, 2023

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Jul 14, 2023

Use a scoped span catcher object, that restores the NoopTracerProvider after a test runs.

If we forget to InstallSpanCatcher() in a test that creates spans, we can see a different valid test fail, because it picks up the extra spans. I don't quite understand why that behavior happens, but I think this PR will eliminate it.

Keep the interface the same so I don't have to update N tests.


This change is Reviewable

@codecov
Copy link

codecov bot commented Jul 14, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (d46495c) 93.68% compared to head (ba982da) 93.68%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #12097   +/-   ##
=======================================
  Coverage   93.68%   93.68%           
=======================================
  Files        2012     2012           
  Lines      175713   175720    +7     
=======================================
+ Hits       164618   164626    +8     
+ Misses      11095    11094    -1     
Impacted Files Coverage Δ
google/cloud/testing_util/opentelemetry_matchers.h 96.42% <ø> (ø)
...oogle/cloud/testing_util/opentelemetry_matchers.cc 33.03% <100.00%> (+4.46%) ⬆️

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dbolduc dbolduc marked this pull request as ready for review July 14, 2023 18:06
@dbolduc dbolduc requested a review from a team as a code owner July 14, 2023 18:06
@dbolduc dbolduc force-pushed the otel-span-catcher-test-cleanup branch from 4bf483d to 6f32cd3 Compare July 14, 2023 19:03
@dbolduc dbolduc merged commit 377079a into googleapis:main Jul 14, 2023
57 checks passed
@dbolduc dbolduc deleted the otel-span-catcher-test-cleanup branch July 14, 2023 21:14
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.

None yet

3 participants