-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore][config/configgrpc] Enable goleak check (#9217)
**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.--> Enables goleak to run on the configgrpc package. Requires ignoring the opencensus-go leak. A few tests required an additional client connection close command to exit the client go routine. Additional information can be found [here](https://pkg.go.dev/google.golang.org/grpc#DialContext) in the explanation for the method grpc.DialContext, specifically this comment: ``` Users should call ClientConn.Close to terminate all the pending operations after this function returns. ``` configgrpc's method [`ToClientConn`](https://github.com/open-telemetry/opentelemetry-collector/blob/36730599ae4fb2ffc05d8e6e8a42e0bb0880703f/config/configgrpc/configgrpc.go#L178) is directly calling the `grpc.DialContext` method referenced. **Link to tracking Issue:** <Issue number if applicable> #9165 **Testing:** <Describe what testing was performed and which tests were added.> Added goleak check is passing
- Loading branch information
Showing
4 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 configgrpc | ||
|
||
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/open-telemetry/opentelemetry-collector/issues/9165#issuecomment-1874836336 for more context. | ||
func TestMain(m *testing.M) { | ||
goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start")) | ||
} |