Skip to content

Commit 0db5457

Browse files
authored
[chore][processor/cumulativetodeltaprocessor] Enable goleak check (#30804)
**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 on all tests in this package, to ensure the processor isn't leaking goroutines. The only update here is in testing, as one test was missing a necessary `shutdown` call. **Link to tracking Issue:** <Issue number if applicable> #30438 **Testing:** <Describe what testing was performed and which tests were added.> All tests are passing, including added `goleak` check.
1 parent 2c29c26 commit 0db5457

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

processor/cumulativetodeltaprocessor/factory_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func TestCreateProcessors(t *testing.T) {
6262
consumertest.NewNop())
6363
assert.NotNil(t, mp)
6464
assert.NoError(t, mErr)
65+
assert.NoError(t, mp.Shutdown(context.Background()))
6566
})
6667
}
6768
}
Lines changed: 17 additions & 0 deletions
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 cumulativetodeltaprocessor
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)