diff --git a/exporter/awscloudwatchlogsexporter/generated_package_test.go b/exporter/awscloudwatchlogsexporter/generated_package_test.go index 205a35c192cc..aee3765c32cb 100644 --- a/exporter/awscloudwatchlogsexporter/generated_package_test.go +++ b/exporter/awscloudwatchlogsexporter/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"), goleak.IgnoreTopFunction("internal/poll.runtime_pollWait")) } diff --git a/exporter/awscloudwatchlogsexporter/metadata.yaml b/exporter/awscloudwatchlogsexporter/metadata.yaml index f05880bc6b2f..8f5bc90e5d7f 100644 --- a/exporter/awscloudwatchlogsexporter/metadata.yaml +++ b/exporter/awscloudwatchlogsexporter/metadata.yaml @@ -17,3 +17,10 @@ tests: retry_on_failure: enabled: false expect_consumer_error: true + goleak: + ignore: + top: + # See https://github.com/census-instrumentation/opencensus-go/issues/1191 for more information. + - "go.opencensus.io/stats/view.(*worker).start" + - "net/http.(*persistConn).writeLoop" + - "internal/poll.runtime_pollWait" diff --git a/exporter/awss3exporter/generated_package_test.go b/exporter/awss3exporter/generated_package_test.go index 9aae1bf83b6d..ff834e53d2f5 100644 --- a/exporter/awss3exporter/generated_package_test.go +++ b/exporter/awss3exporter/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"), goleak.IgnoreTopFunction("internal/poll.runtime_pollWait")) } diff --git a/exporter/awss3exporter/metadata.yaml b/exporter/awss3exporter/metadata.yaml index f40864cded0b..58bbdaed0730 100644 --- a/exporter/awss3exporter/metadata.yaml +++ b/exporter/awss3exporter/metadata.yaml @@ -10,3 +10,8 @@ status: tests: expect_consumer_error: true + goleak: + ignore: + top: + - "net/http.(*persistConn).writeLoop" + - "internal/poll.runtime_pollWait" diff --git a/extension/observer/dockerobserver/extension.go b/extension/observer/dockerobserver/extension.go index 3573c692ceda..f519ab815213 100644 --- a/extension/observer/dockerobserver/extension.go +++ b/extension/observer/dockerobserver/extension.go @@ -104,6 +104,7 @@ func (d *dockerObserver) Start(ctx context.Context, _ component.Host) error { } func (d *dockerObserver) Shutdown(_ context.Context) error { + d.StopListAndWatch() d.cancel() return nil } diff --git a/extension/observer/dockerobserver/generated_package_test.go b/extension/observer/dockerobserver/generated_package_test.go index feed8f51c9e2..219b1d2bfc25 100644 --- a/extension/observer/dockerobserver/generated_package_test.go +++ b/extension/observer/dockerobserver/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"), goleak.IgnoreTopFunction("internal/poll.runtime_pollWait")) } diff --git a/extension/observer/dockerobserver/metadata.yaml b/extension/observer/dockerobserver/metadata.yaml index 6eef0e943897..ddacb2893032 100644 --- a/extension/observer/dockerobserver/metadata.yaml +++ b/extension/observer/dockerobserver/metadata.yaml @@ -11,4 +11,9 @@ status: # TODO: The tests are not passing on Windows. Either fix them or mark component as not supported on Windows. tests: skip_lifecycle: true - skip_shutdown: true \ No newline at end of file + skip_shutdown: true + goleak: + ignore: + top: + - "net/http.(*persistConn).writeLoop" + - "internal/poll.runtime_pollWait" diff --git a/extension/observer/k8sobserver/extension_test.go b/extension/observer/k8sobserver/extension_test.go index 617fb2010d95..ab01da7dec96 100644 --- a/extension/observer/k8sobserver/extension_test.go +++ b/extension/observer/k8sobserver/extension_test.go @@ -127,6 +127,7 @@ func TestExtensionObserveServices(t *testing.T) { }, sink.removed[0]) require.NoError(t, ext.Shutdown(context.Background())) + obs.StopListAndWatch() } func TestExtensionObservePods(t *testing.T) { @@ -209,6 +210,7 @@ func TestExtensionObservePods(t *testing.T) { }, sink.removed[0]) require.NoError(t, ext.Shutdown(context.Background())) + obs.StopListAndWatch() } func TestExtensionObserveNodes(t *testing.T) { @@ -308,4 +310,5 @@ func TestExtensionObserveNodes(t *testing.T) { }, sink.removed[0]) require.NoError(t, ext.Shutdown(context.Background())) + obs.StopListAndWatch() } diff --git a/extension/observer/k8sobserver/generated_package_test.go b/extension/observer/k8sobserver/generated_package_test.go index 75879ee921f0..989f957fd488 100644 --- a/extension/observer/k8sobserver/generated_package_test.go +++ b/extension/observer/k8sobserver/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("k8s.io/apimachinery/pkg/watch.(*Broadcaster).loop")) } diff --git a/extension/observer/k8sobserver/metadata.yaml b/extension/observer/k8sobserver/metadata.yaml index f904c264f191..4c459bc4c9ed 100644 --- a/extension/observer/k8sobserver/metadata.yaml +++ b/extension/observer/k8sobserver/metadata.yaml @@ -12,3 +12,7 @@ status: tests: skip_lifecycle: true skip_shutdown: true + goleak: + ignore: + top: + - "k8s.io/apimachinery/pkg/watch.(*Broadcaster).loop" diff --git a/extension/sigv4authextension/generated_package_test.go b/extension/sigv4authextension/generated_package_test.go index 8abc67be2c27..c0fd1a7c3d93 100644 --- a/extension/sigv4authextension/generated_package_test.go +++ b/extension/sigv4authextension/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"), goleak.IgnoreTopFunction("internal/poll.runtime_pollWait")) } diff --git a/extension/sigv4authextension/metadata.yaml b/extension/sigv4authextension/metadata.yaml index 4cd6bc99acbf..fadb221d0d2a 100644 --- a/extension/sigv4authextension/metadata.yaml +++ b/extension/sigv4authextension/metadata.yaml @@ -10,4 +10,9 @@ status: active: [Aneurysm9, erichsueh3] tests: + goleak: + ignore: + top: + - "net/http.(*persistConn).writeLoop" + - "internal/poll.runtime_pollWait" config: diff --git a/internal/aws/metrics/metric_calculator.go b/internal/aws/metrics/metric_calculator.go index 098b673fbded..5d4118e42cbd 100644 --- a/internal/aws/metrics/metric_calculator.go +++ b/internal/aws/metrics/metric_calculator.go @@ -122,7 +122,7 @@ type MapWithExpiry struct { // NewMapWithExpiry automatically starts a sweeper to enforce the maps TTL. ShutDown() must be called to ensure that these // go routines are properly cleaned up ShutDown() must be called. func NewMapWithExpiry(ttl time.Duration) *MapWithExpiry { - m := &MapWithExpiry{lock: &sync.Mutex{}, ttl: ttl, entries: make(map[any]*MetricValue), doneChan: make(chan struct{})} + m := &MapWithExpiry{lock: &sync.Mutex{}, ttl: ttl, entries: make(map[any]*MetricValue), doneChan: make(chan struct{}, 1000)} go m.sweep(m.CleanUp) return m } diff --git a/processor/geoipprocessor/integration_test.go b/processor/geoipprocessor/integration_test.go index dbe207390c05..57892c2a35a8 100644 --- a/processor/geoipprocessor/integration_test.go +++ b/processor/geoipprocessor/integration_test.go @@ -13,8 +13,6 @@ import ( ) func TestProcessorWithMaxMind(t *testing.T) { - t.Parallel() - tmpDBfiles := testdata.GenerateLocalDB(t, "./internal/provider/maxmindprovider/testdata/") defer os.RemoveAll(tmpDBfiles) diff --git a/receiver/aerospikereceiver/generated_package_test.go b/receiver/aerospikereceiver/generated_package_test.go index 7cd5a1dc2bbc..0c77e23302d7 100644 --- a/receiver/aerospikereceiver/generated_package_test.go +++ b/receiver/aerospikereceiver/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("github.com/aerospike/aerospike-client-go/v7.(*baseMultiCommand).parseRecordResults"), goleak.IgnoreTopFunction("github.com/aerospike/aerospike-client-go/v7.(*Cluster).clusterBoss"), goleak.IgnoreTopFunction("sync.runtime_Semacquire")) } diff --git a/receiver/aerospikereceiver/metadata.yaml b/receiver/aerospikereceiver/metadata.yaml index 987f53a87ea0..a3b437fb3e43 100644 --- a/receiver/aerospikereceiver/metadata.yaml +++ b/receiver/aerospikereceiver/metadata.yaml @@ -9,6 +9,14 @@ status: active: [djaglowski, antonblock] seeking_new: true +tests: + goleak: + ignore: + top: + - "github.com/aerospike/aerospike-client-go/v7.(*baseMultiCommand).parseRecordResults" + - "github.com/aerospike/aerospike-client-go/v7.(*Cluster).clusterBoss" + - "sync.runtime_Semacquire" + resource_attributes: aerospike.node.name: description: Name of the Aerospike node collected from diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux.go index 6cb1b4316bca..536bf767cf3e 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux.go @@ -122,6 +122,7 @@ type Cadvisor struct { k8sDecorator Decorator ecsInfo EcsInfo containerOrchestrator string + metricsExtractors []extractors.MetricExtractor } func init() { @@ -158,15 +159,13 @@ func New(containerOrchestrator string, hostInfo hostInfo, logger *zap.Logger, op return c, nil } -var metricsExtractors = []extractors.MetricExtractor{} - -func GetMetricsExtractors() []extractors.MetricExtractor { - return metricsExtractors +func (c *Cadvisor) GetMetricsExtractors() []extractors.MetricExtractor { + return c.metricsExtractors } func (c *Cadvisor) Shutdown() error { var errs error - for _, ext := range metricsExtractors { + for _, ext := range c.metricsExtractors { errs = errors.Join(errs, ext.Shutdown()) } @@ -341,7 +340,7 @@ func (c *Cadvisor) GetMetrics() []pmetric.Metrics { return result } - out := processContainers(containerinfos, c.hostInfo, c.containerOrchestrator, c.logger) + out := processContainers(containerinfos, c.hostInfo, c.containerOrchestrator, c.logger, c.GetMetricsExtractors()) results := c.decorateMetrics(out) if c.containerOrchestrator == ci.ECS { @@ -394,12 +393,12 @@ func (c *Cadvisor) initManager(createManager createCadvisorManager) error { return err } - metricsExtractors = []extractors.MetricExtractor{} - metricsExtractors = append(metricsExtractors, extractors.NewCPUMetricExtractor(c.logger)) - metricsExtractors = append(metricsExtractors, extractors.NewMemMetricExtractor(c.logger)) - metricsExtractors = append(metricsExtractors, extractors.NewDiskIOMetricExtractor(c.logger)) - metricsExtractors = append(metricsExtractors, extractors.NewNetMetricExtractor(c.logger)) - metricsExtractors = append(metricsExtractors, extractors.NewFileSystemMetricExtractor(c.logger)) + c.metricsExtractors = make([]extractors.MetricExtractor, 0, 5) + c.metricsExtractors = append(c.metricsExtractors, extractors.NewCPUMetricExtractor(c.logger)) + c.metricsExtractors = append(c.metricsExtractors, extractors.NewMemMetricExtractor(c.logger)) + c.metricsExtractors = append(c.metricsExtractors, extractors.NewDiskIOMetricExtractor(c.logger)) + c.metricsExtractors = append(c.metricsExtractors, extractors.NewNetMetricExtractor(c.logger)) + c.metricsExtractors = append(c.metricsExtractors, extractors.NewFileSystemMetricExtractor(c.logger)) return nil } diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux_test.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux_test.go index f1495f4d9e2a..ad56c66def28 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux_test.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_linux_test.go @@ -89,6 +89,7 @@ func TestGetMetrics(t *testing.T) { assert.NotNil(t, c) assert.NoError(t, err) assert.NotNil(t, c.GetMetrics()) + assert.NoError(t, c.Shutdown()) } func TestGetMetricsNoEnv(t *testing.T) { @@ -109,6 +110,7 @@ func TestGetMetricsNoClusterName(t *testing.T) { assert.NotNil(t, c) assert.NoError(t, err) assert.Nil(t, c.GetMetrics()) + assert.NoError(t, c.Shutdown()) } func TestGetMetricsErrorWhenCreatingManager(t *testing.T) { diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/container_info_processor.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/container_info_processor.go index b315abdb98cd..0c714e583ad0 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/container_info_processor.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/container_info_processor.go @@ -37,7 +37,7 @@ type podKey struct { namespace string } -func processContainers(cInfos []*cInfo.ContainerInfo, mInfo extractors.CPUMemInfoProvider, containerOrchestrator string, logger *zap.Logger) []*extractors.CAdvisorMetric { +func processContainers(cInfos []*cInfo.ContainerInfo, mInfo extractors.CPUMemInfoProvider, containerOrchestrator string, logger *zap.Logger, metricExtractors []extractors.MetricExtractor) []*extractors.CAdvisorMetric { var metrics []*extractors.CAdvisorMetric podKeys := make(map[string]podKey) @@ -47,7 +47,7 @@ func processContainers(cInfos []*cInfo.ContainerInfo, mInfo extractors.CPUMemInf if len(info.Stats) == 0 { continue } - outMetrics, outPodKey, err := processContainer(info, mInfo, containerOrchestrator, logger) + outMetrics, outPodKey, err := processContainer(info, mInfo, containerOrchestrator, logger, metricExtractors) if err != nil { logger.Warn("drop some container info", zap.Error(err)) continue @@ -73,7 +73,7 @@ func processContainers(cInfos []*cInfo.ContainerInfo, mInfo extractors.CPUMemInf continue } - metrics = append(metrics, processPod(info, mInfo, podKeys, logger)...) + metrics = append(metrics, processPod(info, mInfo, podKeys, logger, metricExtractors)...) } // This happens when our cgroup path based pod detection logic is not working. @@ -87,7 +87,7 @@ func processContainers(cInfos []*cInfo.ContainerInfo, mInfo extractors.CPUMemInf } // processContainers get metrics for individual container and gather information for pod so we can look it up later. -func processContainer(info *cInfo.ContainerInfo, mInfo extractors.CPUMemInfoProvider, containerOrchestrator string, logger *zap.Logger) ([]*extractors.CAdvisorMetric, *podKey, error) { +func processContainer(info *cInfo.ContainerInfo, mInfo extractors.CPUMemInfoProvider, containerOrchestrator string, logger *zap.Logger, metricExtractors []extractors.MetricExtractor) ([]*extractors.CAdvisorMetric, *podKey, error) { var result []*extractors.CAdvisorMetric var pKey *podKey @@ -152,7 +152,7 @@ func processContainer(info *cInfo.ContainerInfo, mInfo extractors.CPUMemInfoProv tags[ci.Timestamp] = strconv.FormatInt(extractors.GetStats(info).Timestamp.UnixNano(), 10) - for _, extractor := range GetMetricsExtractors() { + for _, extractor := range metricExtractors { if extractor.HasValue(info) { result = append(result, extractor.GetValue(info, mInfo, containerType)...) } @@ -164,7 +164,7 @@ func processContainer(info *cInfo.ContainerInfo, mInfo extractors.CPUMemInfoProv return result, pKey, nil } -func processPod(info *cInfo.ContainerInfo, mInfo extractors.CPUMemInfoProvider, podKeys map[string]podKey, logger *zap.Logger) []*extractors.CAdvisorMetric { +func processPod(info *cInfo.ContainerInfo, mInfo extractors.CPUMemInfoProvider, podKeys map[string]podKey, logger *zap.Logger, metricExtractors []extractors.MetricExtractor) []*extractors.CAdvisorMetric { var result []*extractors.CAdvisorMetric if isContainerInContainer(info.Name) { logger.Debug("drop metric because it's nested container", zap.String("name", info.Name)) @@ -183,7 +183,7 @@ func processPod(info *cInfo.ContainerInfo, mInfo extractors.CPUMemInfoProvider, tags[ci.Timestamp] = strconv.FormatInt(extractors.GetStats(info).Timestamp.UnixNano(), 10) - for _, extractor := range GetMetricsExtractors() { + for _, extractor := range metricExtractors { if extractor.HasValue(info) { result = append(result, extractor.GetValue(info, mInfo, ci.TypePod)...) } diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/container_info_processor_test.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/container_info_processor_test.go index bd9a5b6f566e..e260c2c8ea08 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/container_info_processor_test.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/container_info_processor_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.uber.org/zap" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors" @@ -49,8 +50,7 @@ func TestIsContainerInContainer(t *testing.T) { func TestProcessContainers(t *testing.T) { // set the metrics extractors for testing - originalMetricsExtractors := metricsExtractors - metricsExtractors = []extractors.MetricExtractor{} + metricsExtractors := []extractors.MetricExtractor{} metricsExtractors = append(metricsExtractors, extractors.NewCPUMetricExtractor(zap.NewNop())) metricsExtractors = append(metricsExtractors, extractors.NewMemMetricExtractor(zap.NewNop())) metricsExtractors = append(metricsExtractors, extractors.NewDiskIOMetricExtractor(zap.NewNop())) @@ -63,9 +63,10 @@ func TestProcessContainers(t *testing.T) { containerInContainerInfos := testutils.LoadContainerInfo(t, "./extractors/testdata/ContainerInContainer.json") containerInfos = append(containerInfos, containerInContainerInfos...) mInfo := testutils.MockCPUMemInfo{} - metrics := processContainers(containerInfos, mInfo, "eks", zap.NewNop()) + metrics := processContainers(containerInfos, mInfo, "eks", zap.NewNop(), metricsExtractors) assert.Len(t, metrics, 3) - // restore the original value of metrics extractors - metricsExtractors = originalMetricsExtractors + for _, e := range metricsExtractors { + require.NoError(t, e.Shutdown()) + } } diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/net_extractor_test.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/net_extractor_test.go index 7e5013c9378f..ae4ef170a943 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/net_extractor_test.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/net_extractor_test.go @@ -19,6 +19,7 @@ func TestNetStats(t *testing.T) { containerType := ci.TypeNode extractor := NewNetMetricExtractor(nil) + defer require.NoError(t, extractor.Shutdown()) var cMetrics []*CAdvisorMetric if extractor.HasValue(result[0]) { cMetrics = extractor.GetValue(result[0], nil, containerType) @@ -156,5 +157,4 @@ func TestNetStats(t *testing.T) { for i := range expectedFields { AssertContainsTaggedField(t, cMetrics[i], expectedFields[i], expectedTags[i]) } - require.NoError(t, extractor.Shutdown()) } diff --git a/receiver/datadogreceiver/receiver_test.go b/receiver/datadogreceiver/receiver_test.go index c2df76cb9abc..46051be1a845 100644 --- a/receiver/datadogreceiver/receiver_test.go +++ b/receiver/datadogreceiver/receiver_test.go @@ -213,8 +213,6 @@ func TestDatadogInfoEndpoint(t *testing.T) { } { tc := tc t.Run(tc.name, func(t *testing.T) { - t.Parallel() - cfg := createDefaultConfig().(*Config) cfg.Endpoint = "localhost:0" // Using a randomly assigned address diff --git a/receiver/dockerstatsreceiver/generated_package_test.go b/receiver/dockerstatsreceiver/generated_package_test.go index bb69d6534c4a..78d90526fbe0 100644 --- a/receiver/dockerstatsreceiver/generated_package_test.go +++ b/receiver/dockerstatsreceiver/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("github.com/testcontainers/testcontainers-go.(*Reaper).Connect.func1"), goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"), goleak.IgnoreTopFunction("internal/poll.runtime_pollWait")) } diff --git a/receiver/dockerstatsreceiver/metadata.yaml b/receiver/dockerstatsreceiver/metadata.yaml index e721d4ba574a..c0167c309655 100644 --- a/receiver/dockerstatsreceiver/metadata.yaml +++ b/receiver/dockerstatsreceiver/metadata.yaml @@ -11,6 +11,14 @@ status: sem_conv_version: 1.6.1 +tests: + goleak: + ignore: + top: + - "github.com/testcontainers/testcontainers-go.(*Reaper).Connect.func1" + - "net/http.(*persistConn).writeLoop" + - "internal/poll.runtime_pollWait" + # Note: there are other, additional resource attributes that the user can configure through the yaml resource_attributes: container.runtime: diff --git a/receiver/googlecloudspannerreceiver/internal/filter/itemcardinality_test.go b/receiver/googlecloudspannerreceiver/internal/filter/itemcardinality_test.go index 071ba7573ea5..13c257804715 100644 --- a/receiver/googlecloudspannerreceiver/internal/filter/itemcardinality_test.go +++ b/receiver/googlecloudspannerreceiver/internal/filter/itemcardinality_test.go @@ -147,7 +147,7 @@ func TestItemCardinalityFilter_Filter(t *testing.T) { assert.Empty(t, filteredItems) // Doing this to avoid of relying on timeouts and sleeps(avoid potential flaky tests) - syncChannel := make(chan bool) + syncChannel := make(chan bool, 10) filterCasted.cache.SetExpirationCallback(func(string, any) { if filterCasted.cache.Count() > 0 { @@ -208,7 +208,7 @@ func TestItemCardinalityFilter_FilterItems(t *testing.T) { assert.Len(t, filteredItems, totalLimit) // Doing this to avoid of relying on timeouts and sleeps(avoid potential flaky tests) - syncChannel := make(chan bool) + syncChannel := make(chan bool, 10) filterCasted.cache.SetExpirationCallback(func(string, any) { if filterCasted.cache.Count() > 0 { diff --git a/receiver/googlecloudspannerreceiver/internal/filter/package_test.go b/receiver/googlecloudspannerreceiver/internal/filter/package_test.go index ab3099a83e53..cbe47ab4d895 100644 --- a/receiver/googlecloudspannerreceiver/internal/filter/package_test.go +++ b/receiver/googlecloudspannerreceiver/internal/filter/package_test.go @@ -10,5 +10,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("github.com/ReneKroon/ttlcache/v2.(*Cache).checkExpirationCallback")) } diff --git a/receiver/jmxreceiver/generated_package_test.go b/receiver/jmxreceiver/generated_package_test.go index bc09dc47506d..b9cac6642a72 100644 --- a/receiver/jmxreceiver/generated_package_test.go +++ b/receiver/jmxreceiver/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("internal/poll.runtime_pollWait")) } diff --git a/receiver/jmxreceiver/internal/subprocess/subprocess.go b/receiver/jmxreceiver/internal/subprocess/subprocess.go index b8f3ec0e771b..e1a8dfc48a04 100644 --- a/receiver/jmxreceiver/internal/subprocess/subprocess.go +++ b/receiver/jmxreceiver/internal/subprocess/subprocess.go @@ -85,7 +85,7 @@ func NewSubprocess(conf *Config, logger *zap.Logger) *Subprocess { } return &Subprocess{ - Stdout: make(chan string), + Stdout: make(chan string, 100), pid: pid{pid: noPid, pidLock: sync.Mutex{}}, config: conf, logger: logger, @@ -115,6 +115,7 @@ func (subprocess *Subprocess) Start(ctx context.Context) error { go func() { subprocess.run(cancelCtx) // will block for lifetime of process close(subprocess.shutdownSignal) + close(subprocess.Stdout) }() return nil } diff --git a/receiver/jmxreceiver/metadata.yaml b/receiver/jmxreceiver/metadata.yaml index 6c65bf6ab8ba..10dc005fc7bc 100644 --- a/receiver/jmxreceiver/metadata.yaml +++ b/receiver/jmxreceiver/metadata.yaml @@ -11,3 +11,7 @@ status: tests: config: endpoint: myendpoint:12345 + goleak: + ignore: + top: + - "internal/poll.runtime_pollWait" diff --git a/receiver/pulsarreceiver/generated_package_test.go b/receiver/pulsarreceiver/generated_package_test.go index ac5cde47478c..9c79dea74b59 100644 --- a/receiver/pulsarreceiver/generated_package_test.go +++ b/receiver/pulsarreceiver/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/godbus/dbus.(*Conn).inWorker")) + goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/godbus/dbus.(*Conn).inWorker"), goleak.IgnoreAnyFunction("github.com/apache/pulsar-client-go/pulsar/internal.(*connectionPool).checkAndCleanIdleConnections")) } diff --git a/receiver/pulsarreceiver/metadata.yaml b/receiver/pulsarreceiver/metadata.yaml index 384a82e70f3c..27db05cf87da 100644 --- a/receiver/pulsarreceiver/metadata.yaml +++ b/receiver/pulsarreceiver/metadata.yaml @@ -16,3 +16,4 @@ tests: any: # Regarding the godbus/dbus ignore: see https://github.com/99designs/keyring/issues/103 - "github.com/godbus/dbus.(*Conn).inWorker" + - "github.com/apache/pulsar-client-go/pulsar/internal.(*connectionPool).checkAndCleanIdleConnections" diff --git a/receiver/receivercreator/generated_package_test.go b/receiver/receivercreator/generated_package_test.go index 6d7765a434cd..49ff4271c55d 100644 --- a/receiver/receivercreator/generated_package_test.go +++ b/receiver/receivercreator/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("github.com/SAP/go-hdb/driver.(*metrics).collect")) } diff --git a/receiver/receivercreator/metadata.yaml b/receiver/receivercreator/metadata.yaml index 8dad3f0ac920..d4ef6206c08d 100644 --- a/receiver/receivercreator/metadata.yaml +++ b/receiver/receivercreator/metadata.yaml @@ -7,4 +7,12 @@ status: alpha: [logs, traces] distributions: [contrib] codeowners: - active: [rmfitzpatrick] \ No newline at end of file + active: [rmfitzpatrick] + +tests: + config: + endpoint: myendpoint:12345 + goleak: + ignore: + top: + - "github.com/SAP/go-hdb/driver.(*metrics).collect" diff --git a/receiver/saphanareceiver/generated_package_test.go b/receiver/saphanareceiver/generated_package_test.go index 03e6c83bcb87..c0da5e8db576 100644 --- a/receiver/saphanareceiver/generated_package_test.go +++ b/receiver/saphanareceiver/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("github.com/SAP/go-hdb/driver.(*metrics).collect")) } diff --git a/receiver/saphanareceiver/metadata.yaml b/receiver/saphanareceiver/metadata.yaml index 86bdeaee03f8..0d73e04ca4bb 100644 --- a/receiver/saphanareceiver/metadata.yaml +++ b/receiver/saphanareceiver/metadata.yaml @@ -8,6 +8,12 @@ status: codeowners: active: [dehaansa] +tests: + goleak: + ignore: + top: + - "github.com/SAP/go-hdb/driver.(*metrics).collect" + resource_attributes: saphana.host: type: string