Skip to content

Commit

Permalink
[chore][pkg/stanza/operator/helper] Enable goleak check (open-telemet…
Browse files Browse the repository at this point in the history
…ry#31092)

This enables `goleak` in the `pkg/stanza/operator/helper` package to
help ensure no goroutines are leaking. This is a test only change, some
tests were simply missing `Stop` calls.

**Link to tracking Issue:** open-telemetry#30438
  • Loading branch information
crobert-1 authored Feb 7, 2024
1 parent b8307e5 commit 1bb7923
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/stanza/operator/helper/ip_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func TestIPResolverCacheLookup(t *testing.T) {
}

require.Equal(t, "definitely invalid hostname", resolver.GetHostFromIP("127.0.0.1"))
resolver.Stop()
}

func TestIPResolverCacheInvalidation(t *testing.T) {
Expand Down Expand Up @@ -45,6 +46,7 @@ func TestIPResolver100Hits(t *testing.T) {
for i := 0; i < 100; i++ {
require.Equal(t, "definitely invalid hostname", resolver.GetHostFromIP("127.0.0.1"))
}
resolver.Stop()
}

func TestIPResolverWithMultipleStops(_ *testing.T) {
Expand Down
14 changes: 14 additions & 0 deletions pkg/stanza/operator/helper/package_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package helper

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}

0 comments on commit 1bb7923

Please sign in to comment.