diff --git a/ddtrace/tracer/option_test.go b/ddtrace/tracer/option_test.go index 7ef25b0acd..a14c3e6805 100644 --- a/ddtrace/tracer/option_test.go +++ b/ddtrace/tracer/option_test.go @@ -136,6 +136,8 @@ func TestAutoDetectStatsd(t *testing.T) { require.NoError(t, err) defer statsd.Close() require.Equal(t, cfg.dogstatsdAddr, "unix://"+addr) + // Ensure globalconfig also gets the auto-detected UDS address + require.Equal(t, "unix://"+addr, globalconfig.DogstatsdAddr()) statsd.Count("name", 1, []string{"tag"}, 1) buf := make([]byte, 17) @@ -535,6 +537,20 @@ func TestTracerOptionsDefaults(t *testing.T) { assert.Equal(t, c.dogstatsdAddr, "10.1.0.12:4002") assert.Equal(t, globalconfig.DogstatsdAddr(), "10.1.0.12:4002") }) + t.Run("uds", func(t *testing.T) { + assert := assert.New(t) + dir, err := os.MkdirTemp("", "socket") + if err != nil { + t.Fatal("Failed to create socket") + } + addr := filepath.Join(dir, "dsd.socket") + defer os.RemoveAll(addr) + tracer := newTracer(WithDogstatsdAddress("unix://" + addr)) + defer tracer.Stop() + c := tracer.config + assert.Equal("unix://"+addr, c.dogstatsdAddr) + assert.Equal("unix://"+addr, globalconfig.DogstatsdAddr()) + }) }) t.Run("env-agentAddr", func(t *testing.T) {