diff --git a/cmd/agent/app/testutils/package_test.go b/cmd/agent/app/testutils/package_test.go new file mode 100644 index 00000000000..21172462e87 --- /dev/null +++ b/cmd/agent/app/testutils/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package testutils + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/all-in-one/setupcontext/setupcontext_test.go b/cmd/all-in-one/setupcontext/setupcontext_test.go index 3a5942633c9..270cb5ec9b6 100644 --- a/cmd/all-in-one/setupcontext/setupcontext_test.go +++ b/cmd/all-in-one/setupcontext/setupcontext_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" ) func TestSetupContext(t *testing.T) { @@ -26,3 +27,7 @@ func TestSetupContext(t *testing.T) { defer UnsetAllInOne() assert.True(t, IsAllInOne()) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/anonymizer/app/flags_test.go b/cmd/anonymizer/app/flags_test.go index 80790f15c15..4f913f0ac44 100644 --- a/cmd/anonymizer/app/flags_test.go +++ b/cmd/anonymizer/app/flags_test.go @@ -19,6 +19,7 @@ import ( "github.com/spf13/cobra" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" ) func TestOptionsWithDefaultFlags(t *testing.T) { @@ -60,3 +61,7 @@ func TestOptionsWithFlags(t *testing.T) { assert.Equal(t, true, o.HashProcess) assert.Equal(t, 100, o.MaxSpansCount) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/anonymizer/app/uiconv/package_test.go b/cmd/anonymizer/app/uiconv/package_test.go new file mode 100644 index 00000000000..61f60ecc06c --- /dev/null +++ b/cmd/anonymizer/app/uiconv/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package uiconv + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/collector/app/flags/flags_test.go b/cmd/collector/app/flags/flags_test.go index 6916358e490..8cc0e8eae6e 100644 --- a/cmd/collector/app/flags/flags_test.go +++ b/cmd/collector/app/flags/flags_test.go @@ -20,6 +20,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "go.uber.org/zap" "github.com/jaegertracing/jaeger/pkg/config" @@ -188,3 +189,7 @@ func TestCollectorOptionsWithFlags_CheckZipkinKeepAlive(t *testing.T) { assert.Equal(t, false, c.Zipkin.KeepAlive) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/collector/app/sampling/grpc_handler_test.go b/cmd/collector/app/sampling/grpc_handler_test.go index 31c71bc448f..c0ae1ead7e5 100644 --- a/cmd/collector/app/sampling/grpc_handler_test.go +++ b/cmd/collector/app/sampling/grpc_handler_test.go @@ -20,6 +20,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "golang.org/x/net/context" "github.com/jaegertracing/jaeger/proto-gen/api_v2" @@ -58,3 +59,7 @@ func TestNewGRPCHandler(t *testing.T) { } } } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/collector/app/sanitizer/cache/auto_refresh_cache_test.go b/cmd/collector/app/sanitizer/cache/auto_refresh_cache_test.go index bb40d140ea6..e5de68fd1b4 100644 --- a/cmd/collector/app/sanitizer/cache/auto_refresh_cache_test.go +++ b/cmd/collector/app/sanitizer/cache/auto_refresh_cache_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" "go.uber.org/zap" "github.com/jaegertracing/jaeger/cmd/collector/app/sanitizer/cache/mocks" @@ -227,3 +228,7 @@ func TestIsEmpty(t *testing.T) { c.cache = testCache2 assert.False(t, c.IsEmpty()) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/collector/app/sanitizer/package_test.go b/cmd/collector/app/sanitizer/package_test.go new file mode 100644 index 00000000000..60eb3d22132 --- /dev/null +++ b/cmd/collector/app/sanitizer/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sanitizer + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/collector/app/sanitizer/zipkin/span_sanitizer_test.go b/cmd/collector/app/sanitizer/zipkin/span_sanitizer_test.go index 13419c9f6d4..3c23e5b9d33 100644 --- a/cmd/collector/app/sanitizer/zipkin/span_sanitizer_test.go +++ b/cmd/collector/app/sanitizer/zipkin/span_sanitizer_test.go @@ -19,6 +19,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/thrift-gen/zipkincore" ) @@ -200,3 +201,7 @@ func TestSpanStartTimeSanitizer(t *testing.T) { sanitized = sanitizer.Sanitize(span) assert.Equal(t, int64(20), *sanitized.Timestamp) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/collector/app/zipkin/zipkindeser/package_test.go b/cmd/collector/app/zipkin/zipkindeser/package_test.go new file mode 100644 index 00000000000..594475ad748 --- /dev/null +++ b/cmd/collector/app/zipkin/zipkindeser/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package zipkindeser + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/collector/app/zipkin/zipkindeser/zipkindesermocks/mocks_test.go b/cmd/collector/app/zipkin/zipkindeser/zipkindesermocks/mocks_test.go index 4557043e1a6..1c6231279c2 100644 --- a/cmd/collector/app/zipkin/zipkindeser/zipkindesermocks/mocks_test.go +++ b/cmd/collector/app/zipkin/zipkindeser/zipkindesermocks/mocks_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" ) // Fake test to provide test coverage. @@ -34,3 +35,7 @@ func TestMocks(t *testing.T) { s = CreateSpan("name", "id", "pid", "tid", 100, 100, false, "anno", "binAnno") assert.Equal(t, `[{"name": "name", "id": "id", "parentId": "pid", "traceId": "tid", "timestamp": 100, "duration": 100, "debug": false, "annotations": [anno], "binaryAnnotations": [binAnno]}]`, s) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/es-index-cleaner/app/package_test.go b/cmd/es-index-cleaner/app/package_test.go new file mode 100644 index 00000000000..742c64d352a --- /dev/null +++ b/cmd/es-index-cleaner/app/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package app + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/es-rollover/app/init/package_test.go b/cmd/es-rollover/app/init/package_test.go new file mode 100644 index 00000000000..3630823758f --- /dev/null +++ b/cmd/es-rollover/app/init/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package init + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/es-rollover/app/lookback/package_test.go b/cmd/es-rollover/app/lookback/package_test.go new file mode 100644 index 00000000000..60c7d7f6c58 --- /dev/null +++ b/cmd/es-rollover/app/lookback/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package lookback + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/es-rollover/app/package_test.go b/cmd/es-rollover/app/package_test.go new file mode 100644 index 00000000000..742c64d352a --- /dev/null +++ b/cmd/es-rollover/app/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package app + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/es-rollover/app/rollover/package_test.go b/cmd/es-rollover/app/rollover/package_test.go new file mode 100644 index 00000000000..7550f685e47 --- /dev/null +++ b/cmd/es-rollover/app/rollover/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package rollover + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/esmapping-generator/app/flags_test.go b/cmd/esmapping-generator/app/flags_test.go index 6f4410b2596..f4976b3e589 100644 --- a/cmd/esmapping-generator/app/flags_test.go +++ b/cmd/esmapping-generator/app/flags_test.go @@ -20,6 +20,7 @@ import ( "github.com/spf13/cobra" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" ) func TestOptionsWithDefaultFlags(t *testing.T) { @@ -59,3 +60,7 @@ func TestOptionsWithFlags(t *testing.T) { assert.Equal(t, "true", o.UseILM) assert.Equal(t, "jaeger-test-policy", o.ILMPolicyName) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/esmapping-generator/app/renderer/render_test.go b/cmd/esmapping-generator/app/renderer/render_test.go index ab0f48cbbb5..ca8f4bbaa00 100644 --- a/cmd/esmapping-generator/app/renderer/render_test.go +++ b/cmd/esmapping-generator/app/renderer/render_test.go @@ -21,6 +21,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/cmd/esmapping-generator/app" "github.com/jaegertracing/jaeger/pkg/es/mocks" @@ -97,3 +98,7 @@ func Test_getMappingAsString(t *testing.T) { }) } } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/ingester/app/consumer/offset/package_test.go b/cmd/ingester/app/consumer/offset/package_test.go new file mode 100644 index 00000000000..34432378cf0 --- /dev/null +++ b/cmd/ingester/app/consumer/offset/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package offset + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/ingester/app/flags_test.go b/cmd/ingester/app/flags_test.go index ee1693944c1..ad5fed244b4 100644 --- a/cmd/ingester/app/flags_test.go +++ b/cmd/ingester/app/flags_test.go @@ -21,6 +21,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/config/tlscfg" @@ -110,3 +111,7 @@ func TestFlagDefaults(t *testing.T) { assert.Equal(t, DefaultEncoding, o.Encoding) assert.Equal(t, DefaultDeadlockInterval, o.DeadlockInterval) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/ingester/app/processor/decorator/retry_test.go b/cmd/ingester/app/processor/decorator/retry_test.go index d2127b763a7..ea3ed827d3a 100644 --- a/cmd/ingester/app/processor/decorator/retry_test.go +++ b/cmd/ingester/app/processor/decorator/retry_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/cmd/ingester/app/processor/mocks" "github.com/jaegertracing/jaeger/internal/metricstest" @@ -145,3 +146,7 @@ func Test_ProcessBackoff(t *testing.T) { }) } } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/ingester/app/processor/package_test.go b/cmd/ingester/app/processor/package_test.go new file mode 100644 index 00000000000..f86ce3eaecd --- /dev/null +++ b/cmd/ingester/app/processor/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package processor + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/internal/docs/command_test.go b/cmd/internal/docs/command_test.go index b6fb2181cf4..ae384e5ca33 100644 --- a/cmd/internal/docs/command_test.go +++ b/cmd/internal/docs/command_test.go @@ -23,6 +23,7 @@ import ( "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" ) func TestOutputFormats(t *testing.T) { @@ -66,3 +67,7 @@ func TestDocsForParent(t *testing.T) { require.NoError(t, err) assert.True(t, strings.Contains(string(f), "some description")) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/internal/status/command_test.go b/cmd/internal/status/command_test.go index 47af9ec2bfc..0b5d02a9451 100644 --- a/cmd/internal/status/command_test.go +++ b/cmd/internal/status/command_test.go @@ -22,6 +22,7 @@ import ( "github.com/spf13/viper" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" ) func readyHandler(w http.ResponseWriter, r *http.Request) { @@ -70,3 +71,7 @@ func TestNoService(t *testing.T) { err := cmd.Execute() assert.Error(t, err) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/cmd/query/app/querysvc/query_service_test.go b/cmd/query/app/querysvc/query_service_test.go index 4a8b0031b5b..dab514f2e5d 100644 --- a/cmd/query/app/querysvc/query_service_test.go +++ b/cmd/query/app/querysvc/query_service_test.go @@ -22,6 +22,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "go.uber.org/goleak" "go.uber.org/zap" "github.com/jaegertracing/jaeger/model" @@ -363,3 +364,7 @@ func TestInitArchiveStorage(t *testing.T) { assert.Equal(t, reader, opts.ArchiveSpanReader) assert.Equal(t, writer, opts.ArchiveSpanWriter) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/internal/grpctest/reflection_test.go b/internal/grpctest/reflection_test.go index 0d3782bcd3e..b2b5b7575c7 100644 --- a/internal/grpctest/reflection_test.go +++ b/internal/grpctest/reflection_test.go @@ -19,6 +19,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "google.golang.org/grpc" "google.golang.org/grpc/reflection" ) @@ -43,3 +44,7 @@ func TestReflectionServiceValidator(t *testing.T) { ExpectedServices: []string{"grpc.reflection.v1alpha.ServerReflection"}, }.Execute(t) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/internal/jaegerclientenv2otel/envvars_test.go b/internal/jaegerclientenv2otel/envvars_test.go index 30b59a9f0a4..3c3eeda1434 100644 --- a/internal/jaegerclientenv2otel/envvars_test.go +++ b/internal/jaegerclientenv2otel/envvars_test.go @@ -19,6 +19,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/pkg/testutils" ) @@ -35,3 +36,7 @@ func TestMapJaegerToOtelEnvVars(t *testing.T) { assert.Contains(t, buffer.String(), "Replacing deprecated Jaeger SDK env var JAEGER_USER with OpenTelemetry env var OTEL_EXPORTER_JAEGER_USER") assert.Contains(t, buffer.String(), "Ignoring deprecated Jaeger SDK env var JAEGER_TAGS") } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/internal/metrics/metricsbuilder/builder_test.go b/internal/metrics/metricsbuilder/builder_test.go index a2f7731c8a9..62cb25518d0 100644 --- a/internal/metrics/metricsbuilder/builder_test.go +++ b/internal/metrics/metricsbuilder/builder_test.go @@ -25,6 +25,7 @@ import ( "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/pkg/metrics" ) @@ -124,3 +125,7 @@ func TestBuilder(t *testing.T) { } } } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/internal/metrics/prometheus/factory_test.go b/internal/metrics/prometheus/factory_test.go index 2a875a697b6..a21eed3d8b2 100644 --- a/internal/metrics/prometheus/factory_test.go +++ b/internal/metrics/prometheus/factory_test.go @@ -22,6 +22,7 @@ import ( promModel "github.com/prometheus/client_model/go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" . "github.com/jaegertracing/jaeger/internal/metrics/prometheus" "github.com/jaegertracing/jaeger/pkg/metrics" @@ -435,3 +436,7 @@ func findMetric(t *testing.T, snapshot []*promModel.MetricFamily, name string, t t.FailNow() return nil } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/internal/metricstest/package_test.go b/internal/metricstest/package_test.go new file mode 100644 index 00000000000..bd8eb0d1aef --- /dev/null +++ b/internal/metricstest/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metricstest + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/model/adjuster/package_test.go b/model/adjuster/package_test.go new file mode 100644 index 00000000000..da1507a8c11 --- /dev/null +++ b/model/adjuster/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package adjuster + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/model/converter/json/package_test.go b/model/converter/json/package_test.go new file mode 100644 index 00000000000..0d912d36b34 --- /dev/null +++ b/model/converter/json/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package json + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/model/converter/thrift/jaeger/package_test.go b/model/converter/thrift/jaeger/package_test.go new file mode 100644 index 00000000000..2da64dbb777 --- /dev/null +++ b/model/converter/thrift/jaeger/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package jaeger + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/model/converter/thrift/zipkin/package_test.go b/model/converter/thrift/zipkin/package_test.go new file mode 100644 index 00000000000..23b0380c255 --- /dev/null +++ b/model/converter/thrift/zipkin/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package zipkin + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/model/package_test.go b/model/package_test.go new file mode 100644 index 00000000000..80b77768c79 --- /dev/null +++ b/model/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package model + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/model/trace_test.go b/model/trace_test.go index bbab0aed53d..2152a22fbe0 100644 --- a/model/trace_test.go +++ b/model/trace_test.go @@ -20,7 +20,6 @@ import ( "time" "github.com/stretchr/testify/assert" - "go.uber.org/goleak" "github.com/jaegertracing/jaeger/model" ) @@ -67,7 +66,3 @@ func TestTraceNormalizeTimestamps(t *testing.T) { assert.Equal(t, span.StartTime, tt1.UTC()) assert.Equal(t, span.Logs[0].Timestamp, tt2.UTC()) } - -func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) -} diff --git a/pkg/bearertoken/package_test.go b/pkg/bearertoken/package_test.go new file mode 100644 index 00000000000..f99a55d30a4 --- /dev/null +++ b/pkg/bearertoken/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bearertoken + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/cache/lru_test.go b/pkg/cache/lru_test.go index 4156e99b1b7..a0c6f8d5bf7 100644 --- a/pkg/cache/lru_test.go +++ b/pkg/cache/lru_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" ) func TestLRU(t *testing.T) { @@ -240,3 +241,7 @@ func (c *simulatedClock) Elapse(d time.Duration) time.Time { c.currTime = c.currTime.Add(d) return c.currTime } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/cassandra/metrics/table_test.go b/pkg/cassandra/metrics/table_test.go index a41a92d6be1..f6ef750a7d8 100644 --- a/pkg/cassandra/metrics/table_test.go +++ b/pkg/cassandra/metrics/table_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/internal/metricstest" "github.com/jaegertracing/jaeger/pkg/testutils" @@ -157,3 +158,7 @@ func (q insertQuery) String() string { func (q insertQuery) ScanCAS(dest ...interface{}) (bool, error) { return true, nil } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/clientcfg/clientcfghttp/package_test.go b/pkg/clientcfg/clientcfghttp/package_test.go new file mode 100644 index 00000000000..5f1b9d28a82 --- /dev/null +++ b/pkg/clientcfg/clientcfghttp/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package clientcfghttp + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/config/corscfg/flags_test.go b/pkg/config/corscfg/flags_test.go index 94a9fce5fef..3bf7a2b6f05 100644 --- a/pkg/config/corscfg/flags_test.go +++ b/pkg/config/corscfg/flags_test.go @@ -20,6 +20,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/pkg/config" ) @@ -47,3 +48,7 @@ func TestCORSFlags(t *testing.T) { }, corsOpts) }) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/config/package_test.go b/pkg/config/package_test.go new file mode 100644 index 00000000000..f2f65cd0f1d --- /dev/null +++ b/pkg/config/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package config + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/config/tlscfg/package_test.go b/pkg/config/tlscfg/package_test.go new file mode 100644 index 00000000000..bf7b4f92a79 --- /dev/null +++ b/pkg/config/tlscfg/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tlscfg + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/discovery/grpcresolver/grpc_resolver_test.go b/pkg/discovery/grpcresolver/grpc_resolver_test.go index 991ac78e265..5665ccb99c0 100644 --- a/pkg/discovery/grpcresolver/grpc_resolver_test.go +++ b/pkg/discovery/grpcresolver/grpc_resolver_test.go @@ -23,6 +23,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -174,3 +175,7 @@ func TestRendezvousHash(t *testing.T) { subset2 := resolverInstance.rendezvousHash(sameAddressesDifferentOrder) assert.Equal(t, subset1, subset2) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/discovery/package_test.go b/pkg/discovery/package_test.go new file mode 100644 index 00000000000..fb5a84d11e8 --- /dev/null +++ b/pkg/discovery/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package discovery + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/es/client/package_test.go b/pkg/es/client/package_test.go new file mode 100644 index 00000000000..4181943eb3d --- /dev/null +++ b/pkg/es/client/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/es/filter/package_test.go b/pkg/es/filter/package_test.go new file mode 100644 index 00000000000..d0643a88594 --- /dev/null +++ b/pkg/es/filter/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package filter + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/fswatcher/fswatcher_test.go b/pkg/fswatcher/fswatcher_test.go index 5bbb362f6ef..36a78e03ab7 100644 --- a/pkg/fswatcher/fswatcher_test.go +++ b/pkg/fswatcher/fswatcher_test.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "go.uber.org/zap" "go.uber.org/zap/zapcore" "go.uber.org/zap/zaptest/observer" @@ -239,3 +240,7 @@ func assertLogs(t *testing.T, f func() bool, errorMsg string, logObserver *obser }, ) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/gogocodec/codec_test.go b/pkg/gogocodec/codec_test.go index 5c6f43d7a77..5dfd85c23b2 100644 --- a/pkg/gogocodec/codec_test.go +++ b/pkg/gogocodec/codec_test.go @@ -19,6 +19,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/emptypb" @@ -67,3 +68,7 @@ func TestWireCompatibility(t *testing.T) { require.NoError(t, err) assert.Equal(t, s1, s2) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/gzipfs/gzip_test.go b/pkg/gzipfs/gzip_test.go index 492cd1e7825..ef58453347c 100644 --- a/pkg/gzipfs/gzip_test.go +++ b/pkg/gzipfs/gzip_test.go @@ -24,6 +24,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" ) //go:embed testdata @@ -150,3 +151,7 @@ func TestFileRead(t *testing.T) { require.NoError(t, err) assert.Equal(t, 5, n) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/healthcheck/package_test.go b/pkg/healthcheck/package_test.go new file mode 100644 index 00000000000..4da8b594261 --- /dev/null +++ b/pkg/healthcheck/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package healthcheck + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/hostname/hostname_test.go b/pkg/hostname/hostname_test.go index 34e61bb35b1..7d54f8abfca 100644 --- a/pkg/hostname/hostname_test.go +++ b/pkg/hostname/hostname_test.go @@ -22,6 +22,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" ) func TestAsIdentifier(t *testing.T) { @@ -48,3 +49,7 @@ func TestAsIdentifier(t *testing.T) { assert.Equal(t, hostname1, hostname2) assert.True(t, strings.HasPrefix(hostname1, actualHostname)) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/httpfs/prefixed_test.go b/pkg/httpfs/prefixed_test.go index bb2860a5040..edbc1479420 100644 --- a/pkg/httpfs/prefixed_test.go +++ b/pkg/httpfs/prefixed_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.uber.org/goleak" ) //go:embed test_assets/* @@ -45,3 +46,7 @@ func TestPrefixedFS(t *testing.T) { }) } } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/metrics/metrics_test.go b/pkg/metrics/metrics_test.go index 3a29bcaaf9a..a1231e86167 100644 --- a/pkg/metrics/metrics_test.go +++ b/pkg/metrics/metrics_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/internal/metricstest" "github.com/jaegertracing/jaeger/pkg/metrics" @@ -142,3 +143,7 @@ func TestNullMetrics(t *testing.T) { Name: "name2", }).Update(0) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/netutils/port_test.go b/pkg/netutils/port_test.go index 8af6edf1ee9..0a9ad1924f2 100644 --- a/pkg/netutils/port_test.go +++ b/pkg/netutils/port_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" ) type testAddr struct { @@ -72,3 +73,7 @@ func TestFixLocalhost(t *testing.T) { fixed := FixLocalhost(endpoints) assert.Equal(t, []string{"collector:1111", "localhost:2222"}, fixed) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/normalizer/service_name_test.go b/pkg/normalizer/service_name_test.go index be9155348e8..e0b90bbf1cb 100644 --- a/pkg/normalizer/service_name_test.go +++ b/pkg/normalizer/service_name_test.go @@ -19,6 +19,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" ) func TestServiceNameReplacer(t *testing.T) { @@ -26,3 +27,7 @@ func TestServiceNameReplacer(t *testing.T) { assert.Equal(t, "a_b_c__", ServiceName("a&b%c/:"), "disallowed runes to underscore") assert.Equal(t, "a_z_0123456789.", ServiceName("A_Z_0123456789."), "allowed runes") } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/tenancy/package_test.go b/pkg/tenancy/package_test.go new file mode 100644 index 00000000000..8fb8984f481 --- /dev/null +++ b/pkg/tenancy/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tenancy + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/testutils/logger_test.go b/pkg/testutils/logger_test.go index d36d96fdcc9..ca659a4034b 100644 --- a/pkg/testutils/logger_test.go +++ b/pkg/testutils/logger_test.go @@ -21,6 +21,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" "go.uber.org/zap" ) @@ -97,3 +98,7 @@ func TestLogMatcher(t *testing.T) { }) } } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/metrics/disabled/package_test.go b/plugin/metrics/disabled/package_test.go new file mode 100644 index 00000000000..1877be9fbb6 --- /dev/null +++ b/plugin/metrics/disabled/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package disabled + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/metrics/package_test.go b/plugin/metrics/package_test.go new file mode 100644 index 00000000000..e98f5bce5e9 --- /dev/null +++ b/plugin/metrics/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metrics + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/metrics/prometheus/factory_test.go b/plugin/metrics/prometheus/factory_test.go index 4b9f93190f0..ab187ba52b5 100644 --- a/plugin/metrics/prometheus/factory_test.go +++ b/plugin/metrics/prometheus/factory_test.go @@ -21,6 +21,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "go.uber.org/zap" "github.com/jaegertracing/jaeger/pkg/config" @@ -147,3 +148,7 @@ func TestFailedTLSOptions(t *testing.T) { f.InitFromViper(v, logger) t.Errorf("f.InitFromViper did not panic") } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/metrics/prometheus/metricsstore/dbmodel/to_domain_test.go b/plugin/metrics/prometheus/metricsstore/dbmodel/to_domain_test.go index 01bb762cba7..4ed66f1b611 100644 --- a/plugin/metrics/prometheus/metricsstore/dbmodel/to_domain_test.go +++ b/plugin/metrics/prometheus/metricsstore/dbmodel/to_domain_test.go @@ -22,6 +22,7 @@ import ( "github.com/prometheus/common/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/proto-gen/api_v2/metrics" ) @@ -79,3 +80,7 @@ func TestUnexpectedMetricsFamilyType(t *testing.T) { require.Error(t, err) assert.EqualError(t, err, "unexpected metrics ValueType: vector") } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/pkg/distributedlock/cassandra/lock_test.go b/plugin/pkg/distributedlock/cassandra/lock_test.go index 2ff99da2dc3..528b93d1fae 100644 --- a/plugin/pkg/distributedlock/cassandra/lock_test.go +++ b/plugin/pkg/distributedlock/cassandra/lock_test.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/pkg/cassandra/mocks" ) @@ -268,3 +269,7 @@ func stringMatcher(q string) interface{} { } return mock.MatchedBy(matchFunc) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/sampling/calculationstrategy/package_test.go b/plugin/sampling/calculationstrategy/package_test.go new file mode 100644 index 00000000000..7d9efa7120b --- /dev/null +++ b/plugin/sampling/calculationstrategy/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package calculationstrategy + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/sampling/leaderelection/leader_election_test.go b/plugin/sampling/leaderelection/leader_election_test.go index ab3e9bc8241..00dbfb82b8a 100644 --- a/plugin/sampling/leaderelection/leader_election_test.go +++ b/plugin/sampling/leaderelection/leader_election_test.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/assert" "go.uber.org/atomic" + "go.uber.org/goleak" lmocks "github.com/jaegertracing/jaeger/pkg/distributedlock/mocks" "github.com/jaegertracing/jaeger/pkg/testutils" @@ -106,3 +107,7 @@ func TestRunAcquireLockLoop_followerOnly(t *testing.T) { assert.True(t, match, errMsg) assert.False(t, p.IsLeader()) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/sampling/strategystore/package_test.go b/plugin/sampling/strategystore/package_test.go new file mode 100644 index 00000000000..5a7963d512a --- /dev/null +++ b/plugin/sampling/strategystore/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package strategystore + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/blackhole/package_test.go b/plugin/storage/blackhole/package_test.go new file mode 100644 index 00000000000..1136d3ae302 --- /dev/null +++ b/plugin/storage/blackhole/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package blackhole + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/cassandra/dependencystore/package_test.go b/plugin/storage/cassandra/dependencystore/package_test.go new file mode 100644 index 00000000000..4c775041dc9 --- /dev/null +++ b/plugin/storage/cassandra/dependencystore/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dependencystore + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/cassandra/package_test.go b/plugin/storage/cassandra/package_test.go new file mode 100644 index 00000000000..12ba121f44a --- /dev/null +++ b/plugin/storage/cassandra/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cassandra + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/cassandra/samplingstore/storage_test.go b/plugin/storage/cassandra/samplingstore/storage_test.go index c6a21bb0268..856c78bd608 100644 --- a/plugin/storage/cassandra/samplingstore/storage_test.go +++ b/plugin/storage/cassandra/samplingstore/storage_test.go @@ -23,6 +23,7 @@ import ( "github.com/gocql/gocql" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "go.uber.org/goleak" "go.uber.org/zap" "github.com/jaegertracing/jaeger/cmd/collector/app/sampling/model" @@ -390,3 +391,7 @@ func TestProbabilitiesSetToString(t *testing.T) { assert.True(t, s == "0.000001,0.000002" || s == "0.000002,0.000001") assert.Equal(t, "", probabilitiesSetToString(nil)) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/cassandra/spanstore/dbmodel/package_test.go b/plugin/storage/cassandra/spanstore/dbmodel/package_test.go new file mode 100644 index 00000000000..b7ad360ab64 --- /dev/null +++ b/plugin/storage/cassandra/spanstore/dbmodel/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dbmodel + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/cassandra/spanstore/package_test.go b/plugin/storage/cassandra/spanstore/package_test.go new file mode 100644 index 00000000000..6212c985ef1 --- /dev/null +++ b/plugin/storage/cassandra/spanstore/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spanstore + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/es/dependencystore/dbmodel/converter_test.go b/plugin/storage/es/dependencystore/dbmodel/converter_test.go index 817f3eca0b9..c82a9e274ac 100644 --- a/plugin/storage/es/dependencystore/dbmodel/converter_test.go +++ b/plugin/storage/es/dependencystore/dbmodel/converter_test.go @@ -19,6 +19,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/model" ) @@ -49,3 +50,7 @@ func TestConvertDependencies(t *testing.T) { }) } } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/es/dependencystore/storage_test.go b/plugin/storage/es/dependencystore/storage_test.go index 86ad2177f44..ed48a25f845 100644 --- a/plugin/storage/es/dependencystore/storage_test.go +++ b/plugin/storage/es/dependencystore/storage_test.go @@ -26,6 +26,7 @@ import ( "github.com/olivere/elastic" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "go.uber.org/goleak" "go.uber.org/zap" "github.com/jaegertracing/jaeger/model" @@ -294,3 +295,7 @@ func stringMatcher(q string) interface{} { } return mock.MatchedBy(matchFunc) } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/es/mappings/mapping_test.go b/plugin/storage/es/mappings/mapping_test.go index a1ee8d3b7dd..8c2a5616268 100644 --- a/plugin/storage/es/mappings/mapping_test.go +++ b/plugin/storage/es/mappings/mapping_test.go @@ -26,6 +26,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/pkg/es" "github.com/jaegertracing/jaeger/pkg/es/mocks" @@ -330,3 +331,7 @@ func TestMappingBuilder_GetDependenciesMappings(t *testing.T) { _, err := mappingBuilder.GetDependenciesMappings() assert.EqualError(t, err, "template load error") } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/es/spanstore/dbmodel/package_test.go b/plugin/storage/es/spanstore/dbmodel/package_test.go new file mode 100644 index 00000000000..b7ad360ab64 --- /dev/null +++ b/plugin/storage/es/spanstore/dbmodel/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dbmodel + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/es/spanstore/package_test.go b/plugin/storage/es/spanstore/package_test.go new file mode 100644 index 00000000000..6212c985ef1 --- /dev/null +++ b/plugin/storage/es/spanstore/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spanstore + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/grpc/package_test.go b/plugin/storage/grpc/package_test.go new file mode 100644 index 00000000000..0a7103d2b21 --- /dev/null +++ b/plugin/storage/grpc/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grpc + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/grpc/proto/storage_v1/storage_test.go b/plugin/storage/grpc/proto/storage_v1/storage_test.go index 6d499fcaa0f..eef8a2f261a 100644 --- a/plugin/storage/grpc/proto/storage_v1/storage_test.go +++ b/plugin/storage/grpc/proto/storage_v1/storage_test.go @@ -21,6 +21,7 @@ import ( "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/plugin/storage/grpc/proto/storageprototest" @@ -116,3 +117,7 @@ func makeSpan(someKV model.KeyValue) model.Span { }, } } + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/grpc/shared/package_test.go b/plugin/storage/grpc/shared/package_test.go new file mode 100644 index 00000000000..a611e311553 --- /dev/null +++ b/plugin/storage/grpc/shared/package_test.go @@ -0,0 +1,25 @@ +// Copyright (c) 2023 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package shared + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/scripts/check-goleak-files.sh b/scripts/check-goleak-files.sh index cd51dadb23f..0b60389746c 100755 --- a/scripts/check-goleak-files.sh +++ b/scripts/check-goleak-files.sh @@ -10,6 +10,9 @@ for dir in $*; do continue fi testFiles=$(find "${dir}" -maxdepth 1 -name '*_test.go') + if [[ -z "$testFiles" ]]; then + continue + fi good=0 for test in ${testFiles}; do if grep -q "TestMain" "${test}" | grep -q "goleak.VerifyTestMain" "${test}"; then