Skip to content

Commit 6eadcb8

Browse files
iblancasaXinRanZhAWS
authored andcommitted
[chore] add goleak tests for prometheusreceiver (open-telemetry#31630)
Related to open-telemetry#30438 --------- Signed-off-by: Israel Blancas <[email protected]>
1 parent 52891a4 commit 6eadcb8

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

receiver/prometheusreceiver/go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ require (
2727
go.opentelemetry.io/collector/semconv v0.96.1-0.20240306115632-b2693620eff6
2828
go.opentelemetry.io/otel/metric v1.24.0
2929
go.opentelemetry.io/otel/trace v1.24.0
30+
go.uber.org/goleak v1.3.0
3031
go.uber.org/zap v1.27.0
3132
google.golang.org/protobuf v1.33.0
3233
gopkg.in/yaml.v2 v2.4.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package prometheusreceiver
5+
6+
import (
7+
"testing"
8+
9+
"go.uber.org/goleak"
10+
)
11+
12+
// The IgnoreTopFunction call prevents catching the leak generated by opencensus
13+
// defaultWorker.Start which at this time is part of the package's init call.
14+
// See https://github.com/census-instrumentation/opencensus-go/issues/1191 for more information.
15+
func TestMain(m *testing.M) {
16+
goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"))
17+
}

0 commit comments

Comments
 (0)