Skip to content

Commit

Permalink
[chore][extension/opampextension] Enable goleak check (open-telemetry…
Browse files Browse the repository at this point in the history
…#31175)

**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 enables the `goleak` check for the opamp extension, to help ensure
it's not leaking any goroutines. This is a test only change, a
`Shutdown` call was missing.

**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 the added `goleak` check

---------

Co-authored-by: Antoine Toulme <[email protected]>
Co-authored-by: Pablo Baeyens <[email protected]>
  • Loading branch information
3 people committed Mar 1, 2024
1 parent 2bbd885 commit 78581d3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions extension/opampextension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (
go.opentelemetry.io/collector/semconv v0.95.0
go.opentelemetry.io/otel/metric v1.23.1
go.opentelemetry.io/otel/trace v1.23.1
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
gopkg.in/yaml.v3 v3.0.1
)
Expand Down
1 change: 1 addition & 0 deletions extension/opampextension/opamp_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,5 @@ func TestStart(t *testing.T) {
assert.NoError(t, err)

assert.NoError(t, o.Start(context.TODO(), componenttest.NewNopHost()))
assert.NoError(t, o.Shutdown(context.TODO()))
}
14 changes: 14 additions & 0 deletions extension/opampextension/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 opampextension

import (
"testing"

"go.uber.org/goleak"
)

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

0 comments on commit 78581d3

Please sign in to comment.