Skip to content

Commit

Permalink
Merge branch 'go-leak' of https://github.com/varshith257/jaeger into …
Browse files Browse the repository at this point in the history
…go-leak
  • Loading branch information
varshith257 committed May 21, 2024
2 parents c3c678d + 89bd4c0 commit 86b77b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions pkg/testutils/leakcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ func IgnoreGlogFlushDaemonLeak() goleak.Option {
return goleak.IgnoreTopFunction("github.com/golang/glog.(*fileSink).flushDaemon")
}

// IgnoreElasticHealthCheckerLeak returns a goleak.Option that ignores the healthchecker function
// from the olivere/elastic package that can cause false positives in leak detection.
// This is necessary because elastic starts a goroutine in the background that may not
// be stopped when the test finishes, leading to a detected but expected leak.
func IgnoreElasticHealthCheckerLeak() goleak.Option {
return goleak.IgnoreTopFunction("github.com/olivere/elastic.(*Client).healthchecker")
}

// IgnoreOpenCensusWorkerLeak This prevent catching the leak generated by opencensus defaultWorker.Start which at the time is part of the package's init call.
// See https://github.com/jaegertracing/jaeger/pull/5055#discussion_r1438702168 for more context.
func IgnoreOpenCensusWorkerLeak() goleak.Option {
Expand All @@ -45,7 +37,7 @@ func IgnoreOpenCensusWorkerLeak() goleak.Option {
// VerifyGoLeaks verifies that unit tests do not leak any goroutines.
// It should be called in TestMain.
func VerifyGoLeaks(m *testing.M) {
goleak.VerifyTestMain(m, IgnoreGlogFlushDaemonLeak(), IgnoreOpenCensusWorkerLeak(), IgnoreElasticHealthCheckerLeak())
goleak.VerifyTestMain(m, IgnoreGlogFlushDaemonLeak(), IgnoreOpenCensusWorkerLeak())
}

// VerifyGoLeaksOnce verifies that a given unit test does not leak any goroutines.
Expand Down
2 changes: 1 addition & 1 deletion plugin/storage/integration/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (s *ESStorageIntegration) initializeESFactory(t *testing.T, allTagsAsFields
require.NoError(t, f.Initialize(metrics.NullFactory, logger))

t.Cleanup(func() {
require.NoError(t, s.factory.Close())
require.NoError(t, f.Close())
})
return f
}
Expand Down

0 comments on commit 86b77b5

Please sign in to comment.