From 0913fe9b608cc85186c78a3859ed2477d9dbb015 Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Mon, 15 Apr 2024 15:29:21 -0700 Subject: [PATCH] [chore][receiver/awsxray] Enable goleak checks --- .../internal/udppoller/package_test.go | 14 ++++++++++++++ .../internal/udppoller/poller_test.go | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 receiver/awsxrayreceiver/internal/udppoller/package_test.go diff --git a/receiver/awsxrayreceiver/internal/udppoller/package_test.go b/receiver/awsxrayreceiver/internal/udppoller/package_test.go new file mode 100644 index 000000000000..1d61ceaa2a3c --- /dev/null +++ b/receiver/awsxrayreceiver/internal/udppoller/package_test.go @@ -0,0 +1,14 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package udppoller + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/receiver/awsxrayreceiver/internal/udppoller/poller_test.go b/receiver/awsxrayreceiver/internal/udppoller/poller_test.go index 878939b28a15..960a3bd67a01 100644 --- a/receiver/awsxrayreceiver/internal/udppoller/poller_test.go +++ b/receiver/awsxrayreceiver/internal/udppoller/poller_test.go @@ -291,6 +291,7 @@ func TestSocketReadIrrecoverableNetError(t *testing.T) { } p.Start(context.Background()) + defer func() { assert.NoError(t, p.Close()) }() assert.Eventuallyf(t, func() bool { logs := recordedLogs.All() @@ -328,6 +329,7 @@ func TestSocketReadTimeOutNetError(t *testing.T) { } p.Start(context.Background()) + defer func() { assert.NoError(t, p.Close()) }() assert.Eventuallyf(t, func() bool { logs := recordedLogs.All() @@ -363,6 +365,7 @@ func TestSocketGenericReadError(t *testing.T) { } p.Start(context.Background()) + defer func() { assert.NoError(t, p.Close()) }() assert.Eventuallyf(t, func() bool { logs := recordedLogs.All()