Skip to content

Commit

Permalink
[chore][processor/cumulativetodeltaprocessor] Enable goleak check (op…
Browse files Browse the repository at this point in the history
…en-telemetry#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>
open-telemetry#30438

**Testing:** <Describe what testing was performed and which tests were
added.>
All tests are passing, including added `goleak` check.
  • Loading branch information
crobert-1 authored and cparkins committed Feb 1, 2024
1 parent 139c1a2 commit 2b7aade
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions processor/cumulativetodeltaprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func TestCreateProcessors(t *testing.T) {
consumertest.NewNop())
assert.NotNil(t, mp)
assert.NoError(t, mErr)
assert.NoError(t, mp.Shutdown(context.Background()))
})
}
}
17 changes: 17 additions & 0 deletions processor/cumulativetodeltaprocessor/package_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package cumulativetodeltaprocessor

import (
"testing"

"go.uber.org/goleak"
)

// The IgnoreTopFunction call prevents catching the leak generated by opencensus
// defaultWorker.Start which at this time is part of the package's init call.
// See https://github.com/census-instrumentation/opencensus-go/issues/1191 for more information.
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"))
}

0 comments on commit 2b7aade

Please sign in to comment.