Skip to content

Commit

Permalink
[chore][extension/bearertokenauth] Enable goleak check (open-telemetr…
Browse files Browse the repository at this point in the history
…y#31154)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
This adds `goleak` checks on the `bearertokenauthextension` extension to
help ensure no goroutines are being leaked. This is a test only change.

**Link to tracking Issue:** <Issue number if applicable>
open-telemetry#30438

**Testing:** <Describe what testing was performed and which tests were
added.>
All existing tests are passing as well as added `goleak` check.
  • Loading branch information
crobert-1 committed Feb 13, 2024
1 parent 61abb16 commit 921673e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions extension/bearertokenauthextension/bearertokenauth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func TestBearerTokenFileContentUpdate(t *testing.T) {

assert.Nil(t, bauth.Start(context.Background(), componenttest.NewNopHost()))
assert.Error(t, bauth.Start(context.Background(), componenttest.NewNopHost()))
defer func() { assert.NoError(t, bauth.Shutdown(context.Background())) }()

token, err := os.ReadFile(bauth.filename)
assert.NoError(t, err)
Expand Down
1 change: 1 addition & 0 deletions extension/bearertokenauthextension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
go.opentelemetry.io/collector/extension/auth v0.94.1
go.opentelemetry.io/otel/metric v1.23.0
go.opentelemetry.io/otel/trace v1.23.0
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.26.0
google.golang.org/grpc v1.61.0
)
Expand Down
14 changes: 14 additions & 0 deletions extension/bearertokenauthextension/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 bearertokenauthextension

import (
"testing"

"go.uber.org/goleak"
)

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

0 comments on commit 921673e

Please sign in to comment.