ddtrace/tracer: clear global headers in remote config tests #2466
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.
What does this PR do?
Clear the global headers in the remote config tests which modify them.
Motivation
While following up on #2265, I ran into this failure:
This failure happened because
TestOnRemoteConfigUpdate
ran beforeTestWithHeaderTags
and didn't clean up some globally-configured headers.This is basically the same issue addressed by #2262.
We could consider having each test which accesses global headers clear them at
the start. The downside of that approach would be that we'd miss the chance to
find out which tests don't clean up after themselves (I did in this case by
seeing that
X-Test-Header:my-tag-name-in-code
was still in the map)This PR might not be the ideal solution to this problem in general, but it at
least covers the other existing case of a test which reads these values. Once
we start shuffling unit tests we'll ideally catch these kinds of issues as
they're introduced, and we can come up with a more robust way to prevent them
if it keeps happening.
Reviewer's Checklist
For Datadog employees:
@DataDog/security-design-and-guidance
.Unsure? Have a question? Request a review!