-
Notifications
You must be signed in to change notification settings - Fork 440
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
tracer TestWithHeaderTags: Clear header tags to work with -count=2 #2262
Conversation
This test currently fails when run with -count greater than 2 because it does not clear all the global state. Add a test to ensure there are no header tags set at the end. Clear all headers tags after each test. This should ensure other tests aren't accidentally depending on this. It will help get the tests to pass with -count=10, which can be useful for tracking down flaky tests.
BenchmarksBenchmark execution time: 2023-10-12 14:10:54 Comparing candidate commit 9695a11 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 40 metrics, 1 unstable metrics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but see nit.
ddtrace/tracer/option_test.go
Outdated
t.Run("default-off-at-end", func(t *testing.T) { | ||
defer globalconfig.ClearHeaderTags() | ||
newConfig() | ||
assert.Equal(t, 0, globalconfig.HeaderTagsLen()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to move this assertion into the main test rather than a subtest? This way it also runs when the go test -run
flag is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great suggestion, thank you! Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, 👍 to Felix's comment
What does this PR do?
This test currently fails when run with -count greater than 2 because it does not clear all the global state. Add a test to ensure there are no header tags set at the end. Clear all headers tags after each test.
This should ensure other tests aren't accidentally depending on this. It will help get the tests to pass with -count=10, which can be useful for tracking down flaky tests.
Motivation
I'm trying to track down race bugs, so I tried to run the tests with
-count=10
, and they fail.Reviewer's Checklist
For Datadog employees:
@DataDog/security-design-and-guidance
.Unsure? Have a question? Request a review!