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

ddtrace/tracer: address race detector warning from TestDefaultHTTPClient #1347

Merged
merged 1 commit into from Jun 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions ddtrace/tracer/option_test.go
Expand Up @@ -416,7 +416,10 @@ func TestTracerOptionsDefaults(t *testing.T) {

func TestDefaultHTTPClient(t *testing.T) {
t.Run("no-socket", func(t *testing.T) {
assert.Equal(t, defaultHTTPClient(), defaultClient)
// We care that whether clients are different, but doing a deep
// comparison is overkill and can trigger the race detector, so
// just compare the pointers.
assert.Same(t, defaultHTTPClient(), defaultClient)
})

t.Run("socket", func(t *testing.T) {
Expand All @@ -430,7 +433,7 @@ func TestDefaultHTTPClient(t *testing.T) {
defer os.RemoveAll(f.Name())
defer func(old string) { defaultSocketAPM = old }(defaultSocketAPM)
defaultSocketAPM = f.Name()
assert.NotEqual(t, defaultHTTPClient(), defaultClient)
assert.NotSame(t, defaultHTTPClient(), defaultClient)
})
}

Expand Down