From 5dbec779cb535dedc5695531a87e076f79fddce8 Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Fri, 12 Jan 2024 14:41:55 -0800 Subject: [PATCH] [cmd/configschema/docsgen/docsgen] Enable goleak --- .../docsgen/docsgen/package_test.go | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 cmd/configschema/docsgen/docsgen/package_test.go diff --git a/cmd/configschema/docsgen/docsgen/package_test.go b/cmd/configschema/docsgen/docsgen/package_test.go new file mode 100644 index 000000000000..b0e28474f911 --- /dev/null +++ b/cmd/configschema/docsgen/docsgen/package_test.go @@ -0,0 +1,31 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package docsgen + +import ( + "testing" + + "go.uber.org/goleak" +) + +// The Ignore function calls prevent catching leaks generated by indirect dependencies. +// All of these are leaks that we can't fix from within the collector code base. +// Regarding the OpenCensus ignore: see https://github.com/census-instrumentation/opencensus-go/issues/1191 +// Regarding the DataDog ignore: see https://github.com/DataDog/datadog-agent/issues/22030 +// Regarding the database/sql ignore: see https://github.com/SAP/go-hdb/issues/130 +// Regarding the SAP/go-hdb ignore: see https://github.com/SAP/go-hdb/issues/131 +// Regarding the cihub/seelog ignore: see https://github.com/cihub/seelog/issues/182 +// Regarding the godbus/dbus ignore: see https://github.com/99designs/keyring/issues/135 +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m, + goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), + goleak.IgnoreTopFunction("github.com/DataDog/datadog-agent/pkg/trace/metrics/timing.(*Set).Autoreport.func1"), + // Unfortunately this ignore can't be anymore specific, even though it's caused by the SAP/go-hdb/driver + // package. There's no reference to this package in the goleak output. This has the potential of + // hiding future leaks, so we should remove as soon as the referenced issue is resolved. + goleak.IgnoreTopFunction("database/sql.(*DB).connectionOpener"), + goleak.IgnoreTopFunction("github.com/SAP/go-hdb/driver.(*metrics).collect"), + goleak.IgnoreAnyFunction("github.com/cihub/seelog.(*asyncLoopLogger).processQueue"), + goleak.IgnoreAnyFunction("github.com/godbus/dbus.(*Conn).inWorker")) +}