diff --git a/receiver/jaegerreceiver/go.mod b/receiver/jaegerreceiver/go.mod index 926d00b84ada..48e9e7b07d5b 100644 --- a/receiver/jaegerreceiver/go.mod +++ b/receiver/jaegerreceiver/go.mod @@ -22,6 +22,7 @@ require ( go.opentelemetry.io/collector/semconv v0.96.1-0.20240306115632-b2693620eff6 go.opentelemetry.io/otel/metric v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 + go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 google.golang.org/grpc v1.62.1 diff --git a/receiver/jaegerreceiver/jaeger_agent_test.go b/receiver/jaegerreceiver/jaeger_agent_test.go index aa1e5673ba41..77e07cfca7ea 100644 --- a/receiver/jaegerreceiver/jaeger_agent_test.go +++ b/receiver/jaegerreceiver/jaeger_agent_test.go @@ -161,11 +161,9 @@ func TestJaegerHTTP(t *testing.T) { resp, err := http.Get(fmt.Sprintf("http://%s/sampling?service=test", endpoint)) assert.NoError(t, err, "should not have failed to make request") - if resp != nil { - assert.Equal(t, 500, resp.StatusCode, "should have returned 200") - return - } - t.Fail() + assert.NotNil(t, resp) + defer resp.Body.Close() + assert.Equal(t, 500, resp.StatusCode, "should have returned 200") } func testJaegerAgent(t *testing.T, agentEndpoint string, receiverConfig *configuration) { diff --git a/receiver/jaegerreceiver/package_test.go b/receiver/jaegerreceiver/package_test.go new file mode 100644 index 000000000000..79fe99141725 --- /dev/null +++ b/receiver/jaegerreceiver/package_test.go @@ -0,0 +1,14 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package jaegerreceiver + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +}