From fc78e6fd23d8bf09e128ade02ba5abfcc2d6b64a Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Fri, 22 Dec 2023 00:37:32 +0530 Subject: [PATCH 1/5] add goleak in tests Signed-off-by: Harshvir Potpose --- cmd/agent/app/testutils/package_test.go | 11 +++++++++++ cmd/all-in-one/setupcontext/setupcontext_test.go | 5 +++++ cmd/anonymizer/app/flags_test.go | 5 +++++ cmd/anonymizer/app/uiconv/package_test.go | 11 +++++++++++ cmd/collector/app/flags/flags_test.go | 5 +++++ cmd/collector/app/sampling/grpc_handler_test.go | 5 +++++ .../app/sanitizer/cache/auto_refresh_cache_test.go | 5 +++++ cmd/collector/app/sanitizer/package_test.go | 11 +++++++++++ .../app/sanitizer/zipkin/span_sanitizer_test.go | 5 +++++ cmd/collector/app/zipkin/zipkindeser/package_test.go | 11 +++++++++++ .../zipkin/zipkindeser/zipkindesermocks/mocks_test.go | 5 +++++ cmd/es-index-cleaner/app/package_test.go | 11 +++++++++++ cmd/es-rollover/app/init/package_test.go | 11 +++++++++++ cmd/es-rollover/app/lookback/package_test.go | 11 +++++++++++ cmd/es-rollover/app/package_test.go | 11 +++++++++++ cmd/es-rollover/app/rollover/package_test.go | 11 +++++++++++ cmd/esmapping-generator/app/flags_test.go | 5 +++++ cmd/esmapping-generator/app/renderer/render_test.go | 5 +++++ cmd/ingester/app/consumer/offset/package_test.go | 11 +++++++++++ cmd/ingester/app/flags_test.go | 5 +++++ cmd/ingester/app/processor/decorator/retry_test.go | 5 +++++ cmd/ingester/app/processor/package_test.go | 11 +++++++++++ cmd/internal/docs/command_test.go | 5 +++++ cmd/internal/status/command_test.go | 5 +++++ cmd/query/app/querysvc/query_service_test.go | 5 +++++ internal/grpctest/reflection_test.go | 5 +++++ internal/jaegerclientenv2otel/envvars_test.go | 5 +++++ internal/metrics/metricsbuilder/builder_test.go | 5 +++++ internal/metrics/prometheus/factory_test.go | 5 +++++ internal/metricstest/package_test.go | 11 +++++++++++ model/adjuster/package_test.go | 11 +++++++++++ model/converter/json/package_test.go | 11 +++++++++++ model/converter/thrift/jaeger/package_test.go | 11 +++++++++++ model/converter/thrift/zipkin/package_test.go | 11 +++++++++++ model/package_test.go | 11 +++++++++++ model/trace_test.go | 5 ----- pkg/bearertoken/package_test.go | 11 +++++++++++ pkg/cache/lru_test.go | 5 +++++ pkg/cassandra/metrics/table_test.go | 5 +++++ pkg/clientcfg/clientcfghttp/package_test.go | 11 +++++++++++ pkg/config/corscfg/flags_test.go | 5 +++++ pkg/config/package_test.go | 11 +++++++++++ pkg/config/tlscfg/package_test.go | 11 +++++++++++ pkg/discovery/grpcresolver/grpc_resolver_test.go | 5 +++++ pkg/discovery/package_test.go | 11 +++++++++++ pkg/es/client/package_test.go | 11 +++++++++++ pkg/es/filter/package_test.go | 11 +++++++++++ pkg/fswatcher/fswatcher_test.go | 5 +++++ pkg/gogocodec/codec_test.go | 5 +++++ pkg/gzipfs/gzip_test.go | 5 +++++ pkg/healthcheck/package_test.go | 11 +++++++++++ pkg/hostname/hostname_test.go | 5 +++++ pkg/httpfs/prefixed_test.go | 5 +++++ pkg/metrics/metrics_test.go | 5 +++++ pkg/netutils/port_test.go | 5 +++++ pkg/normalizer/service_name_test.go | 5 +++++ pkg/tenancy/package_test.go | 11 +++++++++++ pkg/testutils/logger_test.go | 5 +++++ plugin/metrics/disabled/package_test.go | 11 +++++++++++ plugin/metrics/package_test.go | 11 +++++++++++ plugin/metrics/prometheus/factory_test.go | 5 +++++ .../prometheus/metricsstore/dbmodel/to_domain_test.go | 5 +++++ plugin/pkg/distributedlock/cassandra/lock_test.go | 5 +++++ plugin/sampling/calculationstrategy/package_test.go | 11 +++++++++++ 64 files changed, 489 insertions(+), 5 deletions(-) create mode 100644 cmd/agent/app/testutils/package_test.go create mode 100644 cmd/anonymizer/app/uiconv/package_test.go create mode 100644 cmd/collector/app/sanitizer/package_test.go create mode 100644 cmd/collector/app/zipkin/zipkindeser/package_test.go create mode 100644 cmd/es-index-cleaner/app/package_test.go create mode 100644 cmd/es-rollover/app/init/package_test.go create mode 100644 cmd/es-rollover/app/lookback/package_test.go create mode 100644 cmd/es-rollover/app/package_test.go create mode 100644 cmd/es-rollover/app/rollover/package_test.go create mode 100644 cmd/ingester/app/consumer/offset/package_test.go create mode 100644 cmd/ingester/app/processor/package_test.go create mode 100644 internal/metricstest/package_test.go create mode 100644 model/adjuster/package_test.go create mode 100644 model/converter/json/package_test.go create mode 100644 model/converter/thrift/jaeger/package_test.go create mode 100644 model/converter/thrift/zipkin/package_test.go create mode 100644 model/package_test.go create mode 100644 pkg/bearertoken/package_test.go create mode 100644 pkg/clientcfg/clientcfghttp/package_test.go create mode 100644 pkg/config/package_test.go create mode 100644 pkg/config/tlscfg/package_test.go create mode 100644 pkg/discovery/package_test.go create mode 100644 pkg/es/client/package_test.go create mode 100644 pkg/es/filter/package_test.go create mode 100644 pkg/healthcheck/package_test.go create mode 100644 pkg/tenancy/package_test.go create mode 100644 plugin/metrics/disabled/package_test.go create mode 100644 plugin/metrics/package_test.go create mode 100644 plugin/sampling/calculationstrategy/package_test.go diff --git a/cmd/agent/app/testutils/package_test.go b/cmd/agent/app/testutils/package_test.go new file mode 100644 index 00000000000..1f10e513f91 --- /dev/null +++ b/cmd/agent/app/testutils/package_test.go @@ -0,0 +1,11 @@ +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..ac16402cf5a --- /dev/null +++ b/cmd/anonymizer/app/uiconv/package_test.go @@ -0,0 +1,11 @@ +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..196ff251e3e --- /dev/null +++ b/cmd/collector/app/sanitizer/package_test.go @@ -0,0 +1,11 @@ +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..29fc00032f5 --- /dev/null +++ b/cmd/collector/app/zipkin/zipkindeser/package_test.go @@ -0,0 +1,11 @@ +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..fee8557b7d0 --- /dev/null +++ b/cmd/es-index-cleaner/app/package_test.go @@ -0,0 +1,11 @@ +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..48c0206c31d --- /dev/null +++ b/cmd/es-rollover/app/init/package_test.go @@ -0,0 +1,11 @@ +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..0695a4ec556 --- /dev/null +++ b/cmd/es-rollover/app/lookback/package_test.go @@ -0,0 +1,11 @@ +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..fee8557b7d0 --- /dev/null +++ b/cmd/es-rollover/app/package_test.go @@ -0,0 +1,11 @@ +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..f886c30cb1e --- /dev/null +++ b/cmd/es-rollover/app/rollover/package_test.go @@ -0,0 +1,11 @@ +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..6f0a3aa2600 --- /dev/null +++ b/cmd/ingester/app/consumer/offset/package_test.go @@ -0,0 +1,11 @@ +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..a26d8b1c22a --- /dev/null +++ b/cmd/ingester/app/processor/package_test.go @@ -0,0 +1,11 @@ +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..8e5198cbae3 --- /dev/null +++ b/internal/metricstest/package_test.go @@ -0,0 +1,11 @@ +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..e34596cf7cb --- /dev/null +++ b/model/adjuster/package_test.go @@ -0,0 +1,11 @@ +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..e99dc7742aa --- /dev/null +++ b/model/converter/json/package_test.go @@ -0,0 +1,11 @@ +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..fa90bd28d90 --- /dev/null +++ b/model/converter/thrift/jaeger/package_test.go @@ -0,0 +1,11 @@ +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..5d371a1a35e --- /dev/null +++ b/model/converter/thrift/zipkin/package_test.go @@ -0,0 +1,11 @@ +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..0ecfc3e4086 --- /dev/null +++ b/model/package_test.go @@ -0,0 +1,11 @@ +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..58bf1015923 --- /dev/null +++ b/pkg/bearertoken/package_test.go @@ -0,0 +1,11 @@ +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..0c77c18a6bf --- /dev/null +++ b/pkg/clientcfg/clientcfghttp/package_test.go @@ -0,0 +1,11 @@ +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..9be74f109c3 --- /dev/null +++ b/pkg/config/package_test.go @@ -0,0 +1,11 @@ +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..57d0c469890 --- /dev/null +++ b/pkg/config/tlscfg/package_test.go @@ -0,0 +1,11 @@ +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..c191ae3af94 --- /dev/null +++ b/pkg/discovery/package_test.go @@ -0,0 +1,11 @@ +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..1512ba3d95c --- /dev/null +++ b/pkg/es/client/package_test.go @@ -0,0 +1,11 @@ +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..3c4b28b78ac --- /dev/null +++ b/pkg/es/filter/package_test.go @@ -0,0 +1,11 @@ +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..11cf8a259ce --- /dev/null +++ b/pkg/healthcheck/package_test.go @@ -0,0 +1,11 @@ +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..bae65a28a8d --- /dev/null +++ b/pkg/tenancy/package_test.go @@ -0,0 +1,11 @@ +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..e451f6bcd64 --- /dev/null +++ b/plugin/metrics/disabled/package_test.go @@ -0,0 +1,11 @@ +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..33a11e122fc --- /dev/null +++ b/plugin/metrics/package_test.go @@ -0,0 +1,11 @@ +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..1f5390a1cca --- /dev/null +++ b/plugin/sampling/calculationstrategy/package_test.go @@ -0,0 +1,11 @@ +package calculationstrategy + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} From 6273640c825efdf4d7bda911ecf5c1eb5e14dae5 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Fri, 22 Dec 2023 00:56:12 +0530 Subject: [PATCH 2/5] add goleak in non failing tests Signed-off-by: Harshvir Potpose --- .../sampling/leaderelection/leader_election_test.go | 5 +++++ plugin/sampling/strategystore/package_test.go | 11 +++++++++++ plugin/storage/blackhole/package_test.go | 11 +++++++++++ .../storage/cassandra/dependencystore/package_test.go | 11 +++++++++++ plugin/storage/cassandra/package_test.go | 11 +++++++++++ .../storage/cassandra/samplingstore/storage_test.go | 5 +++++ .../cassandra/spanstore/dbmodel/package_test.go | 11 +++++++++++ plugin/storage/cassandra/spanstore/package_test.go | 11 +++++++++++ .../es/dependencystore/dbmodel/converter_test.go | 5 +++++ plugin/storage/es/dependencystore/storage_test.go | 5 +++++ plugin/storage/es/mappings/mapping_test.go | 5 +++++ plugin/storage/es/spanstore/dbmodel/package_test.go | 11 +++++++++++ plugin/storage/es/spanstore/package_test.go | 11 +++++++++++ plugin/storage/grpc/package_test.go | 11 +++++++++++ plugin/storage/grpc/proto/storage_v1/storage_test.go | 5 +++++ plugin/storage/grpc/shared/package_test.go | 11 +++++++++++ plugin/storage/integration/package_test.go | 11 +++++++++++ scripts/check-goleak-files.sh | 3 +++ 18 files changed, 154 insertions(+) create mode 100644 plugin/sampling/strategystore/package_test.go create mode 100644 plugin/storage/blackhole/package_test.go create mode 100644 plugin/storage/cassandra/dependencystore/package_test.go create mode 100644 plugin/storage/cassandra/package_test.go create mode 100644 plugin/storage/cassandra/spanstore/dbmodel/package_test.go create mode 100644 plugin/storage/cassandra/spanstore/package_test.go create mode 100644 plugin/storage/es/spanstore/dbmodel/package_test.go create mode 100644 plugin/storage/es/spanstore/package_test.go create mode 100644 plugin/storage/grpc/package_test.go create mode 100644 plugin/storage/grpc/shared/package_test.go create mode 100644 plugin/storage/integration/package_test.go 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..38c7f32d208 --- /dev/null +++ b/plugin/sampling/strategystore/package_test.go @@ -0,0 +1,11 @@ +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..3ddbe46be3a --- /dev/null +++ b/plugin/storage/blackhole/package_test.go @@ -0,0 +1,11 @@ +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..4897ac87426 --- /dev/null +++ b/plugin/storage/cassandra/dependencystore/package_test.go @@ -0,0 +1,11 @@ +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..64ae017b738 --- /dev/null +++ b/plugin/storage/cassandra/package_test.go @@ -0,0 +1,11 @@ +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..fc35bc448b1 --- /dev/null +++ b/plugin/storage/cassandra/spanstore/dbmodel/package_test.go @@ -0,0 +1,11 @@ +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..d818e591213 --- /dev/null +++ b/plugin/storage/cassandra/spanstore/package_test.go @@ -0,0 +1,11 @@ +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..fc35bc448b1 --- /dev/null +++ b/plugin/storage/es/spanstore/dbmodel/package_test.go @@ -0,0 +1,11 @@ +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..d818e591213 --- /dev/null +++ b/plugin/storage/es/spanstore/package_test.go @@ -0,0 +1,11 @@ +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..e7ec28386a1 --- /dev/null +++ b/plugin/storage/grpc/package_test.go @@ -0,0 +1,11 @@ +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..192c10775b0 --- /dev/null +++ b/plugin/storage/grpc/shared/package_test.go @@ -0,0 +1,11 @@ +package shared + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/plugin/storage/integration/package_test.go b/plugin/storage/integration/package_test.go new file mode 100644 index 00000000000..063ff28340c --- /dev/null +++ b/plugin/storage/integration/package_test.go @@ -0,0 +1,11 @@ +package integration + +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..c9e371ba6e3 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 From 70c67f937aa0125e97e4a8e01e57c8ef59dded14 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Fri, 22 Dec 2023 00:59:06 +0530 Subject: [PATCH 3/5] run go fmt Signed-off-by: Harshvir Potpose --- cmd/agent/app/testutils/package_test.go | 14 ++++++++++++++ cmd/anonymizer/app/uiconv/package_test.go | 14 ++++++++++++++ cmd/collector/app/sanitizer/package_test.go | 14 ++++++++++++++ .../app/zipkin/zipkindeser/package_test.go | 14 ++++++++++++++ cmd/es-index-cleaner/app/package_test.go | 14 ++++++++++++++ cmd/es-rollover/app/init/package_test.go | 14 ++++++++++++++ cmd/es-rollover/app/lookback/package_test.go | 14 ++++++++++++++ cmd/es-rollover/app/package_test.go | 14 ++++++++++++++ cmd/es-rollover/app/rollover/package_test.go | 14 ++++++++++++++ cmd/ingester/app/consumer/offset/package_test.go | 14 ++++++++++++++ cmd/ingester/app/processor/package_test.go | 14 ++++++++++++++ internal/metricstest/package_test.go | 14 ++++++++++++++ model/adjuster/package_test.go | 14 ++++++++++++++ model/converter/json/package_test.go | 14 ++++++++++++++ model/converter/thrift/jaeger/package_test.go | 14 ++++++++++++++ model/converter/thrift/zipkin/package_test.go | 14 ++++++++++++++ model/package_test.go | 14 ++++++++++++++ pkg/bearertoken/package_test.go | 14 ++++++++++++++ pkg/clientcfg/clientcfghttp/package_test.go | 14 ++++++++++++++ pkg/config/package_test.go | 14 ++++++++++++++ pkg/config/tlscfg/package_test.go | 14 ++++++++++++++ pkg/discovery/package_test.go | 14 ++++++++++++++ pkg/es/client/package_test.go | 14 ++++++++++++++ pkg/es/filter/package_test.go | 14 ++++++++++++++ pkg/healthcheck/package_test.go | 14 ++++++++++++++ pkg/tenancy/package_test.go | 14 ++++++++++++++ plugin/metrics/disabled/package_test.go | 14 ++++++++++++++ plugin/metrics/package_test.go | 14 ++++++++++++++ .../sampling/calculationstrategy/package_test.go | 14 ++++++++++++++ plugin/sampling/strategystore/package_test.go | 14 ++++++++++++++ plugin/storage/blackhole/package_test.go | 14 ++++++++++++++ .../cassandra/dependencystore/package_test.go | 14 ++++++++++++++ plugin/storage/cassandra/package_test.go | 14 ++++++++++++++ .../cassandra/spanstore/dbmodel/package_test.go | 14 ++++++++++++++ plugin/storage/cassandra/spanstore/package_test.go | 14 ++++++++++++++ .../storage/es/spanstore/dbmodel/package_test.go | 14 ++++++++++++++ plugin/storage/es/spanstore/package_test.go | 14 ++++++++++++++ plugin/storage/grpc/package_test.go | 14 ++++++++++++++ plugin/storage/grpc/shared/package_test.go | 14 ++++++++++++++ plugin/storage/integration/package_test.go | 14 ++++++++++++++ scripts/check-goleak-files.sh | 3 --- 41 files changed, 560 insertions(+), 3 deletions(-) diff --git a/cmd/agent/app/testutils/package_test.go b/cmd/agent/app/testutils/package_test.go index 1f10e513f91..21172462e87 100644 --- a/cmd/agent/app/testutils/package_test.go +++ b/cmd/agent/app/testutils/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/cmd/anonymizer/app/uiconv/package_test.go b/cmd/anonymizer/app/uiconv/package_test.go index ac16402cf5a..61f60ecc06c 100644 --- a/cmd/anonymizer/app/uiconv/package_test.go +++ b/cmd/anonymizer/app/uiconv/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/cmd/collector/app/sanitizer/package_test.go b/cmd/collector/app/sanitizer/package_test.go index 196ff251e3e..60eb3d22132 100644 --- a/cmd/collector/app/sanitizer/package_test.go +++ b/cmd/collector/app/sanitizer/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/cmd/collector/app/zipkin/zipkindeser/package_test.go b/cmd/collector/app/zipkin/zipkindeser/package_test.go index 29fc00032f5..594475ad748 100644 --- a/cmd/collector/app/zipkin/zipkindeser/package_test.go +++ b/cmd/collector/app/zipkin/zipkindeser/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/cmd/es-index-cleaner/app/package_test.go b/cmd/es-index-cleaner/app/package_test.go index fee8557b7d0..742c64d352a 100644 --- a/cmd/es-index-cleaner/app/package_test.go +++ b/cmd/es-index-cleaner/app/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/cmd/es-rollover/app/init/package_test.go b/cmd/es-rollover/app/init/package_test.go index 48c0206c31d..3630823758f 100644 --- a/cmd/es-rollover/app/init/package_test.go +++ b/cmd/es-rollover/app/init/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/cmd/es-rollover/app/lookback/package_test.go b/cmd/es-rollover/app/lookback/package_test.go index 0695a4ec556..60c7d7f6c58 100644 --- a/cmd/es-rollover/app/lookback/package_test.go +++ b/cmd/es-rollover/app/lookback/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/cmd/es-rollover/app/package_test.go b/cmd/es-rollover/app/package_test.go index fee8557b7d0..742c64d352a 100644 --- a/cmd/es-rollover/app/package_test.go +++ b/cmd/es-rollover/app/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/cmd/es-rollover/app/rollover/package_test.go b/cmd/es-rollover/app/rollover/package_test.go index f886c30cb1e..7550f685e47 100644 --- a/cmd/es-rollover/app/rollover/package_test.go +++ b/cmd/es-rollover/app/rollover/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/cmd/ingester/app/consumer/offset/package_test.go b/cmd/ingester/app/consumer/offset/package_test.go index 6f0a3aa2600..34432378cf0 100644 --- a/cmd/ingester/app/consumer/offset/package_test.go +++ b/cmd/ingester/app/consumer/offset/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/cmd/ingester/app/processor/package_test.go b/cmd/ingester/app/processor/package_test.go index a26d8b1c22a..f86ce3eaecd 100644 --- a/cmd/ingester/app/processor/package_test.go +++ b/cmd/ingester/app/processor/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/internal/metricstest/package_test.go b/internal/metricstest/package_test.go index 8e5198cbae3..bd8eb0d1aef 100644 --- a/internal/metricstest/package_test.go +++ b/internal/metricstest/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/model/adjuster/package_test.go b/model/adjuster/package_test.go index e34596cf7cb..da1507a8c11 100644 --- a/model/adjuster/package_test.go +++ b/model/adjuster/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/model/converter/json/package_test.go b/model/converter/json/package_test.go index e99dc7742aa..0d912d36b34 100644 --- a/model/converter/json/package_test.go +++ b/model/converter/json/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/model/converter/thrift/jaeger/package_test.go b/model/converter/thrift/jaeger/package_test.go index fa90bd28d90..2da64dbb777 100644 --- a/model/converter/thrift/jaeger/package_test.go +++ b/model/converter/thrift/jaeger/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/model/converter/thrift/zipkin/package_test.go b/model/converter/thrift/zipkin/package_test.go index 5d371a1a35e..23b0380c255 100644 --- a/model/converter/thrift/zipkin/package_test.go +++ b/model/converter/thrift/zipkin/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/model/package_test.go b/model/package_test.go index 0ecfc3e4086..80b77768c79 100644 --- a/model/package_test.go +++ b/model/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/pkg/bearertoken/package_test.go b/pkg/bearertoken/package_test.go index 58bf1015923..f99a55d30a4 100644 --- a/pkg/bearertoken/package_test.go +++ b/pkg/bearertoken/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/pkg/clientcfg/clientcfghttp/package_test.go b/pkg/clientcfg/clientcfghttp/package_test.go index 0c77c18a6bf..5f1b9d28a82 100644 --- a/pkg/clientcfg/clientcfghttp/package_test.go +++ b/pkg/clientcfg/clientcfghttp/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/pkg/config/package_test.go b/pkg/config/package_test.go index 9be74f109c3..f2f65cd0f1d 100644 --- a/pkg/config/package_test.go +++ b/pkg/config/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/pkg/config/tlscfg/package_test.go b/pkg/config/tlscfg/package_test.go index 57d0c469890..bf7b4f92a79 100644 --- a/pkg/config/tlscfg/package_test.go +++ b/pkg/config/tlscfg/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/pkg/discovery/package_test.go b/pkg/discovery/package_test.go index c191ae3af94..fb5a84d11e8 100644 --- a/pkg/discovery/package_test.go +++ b/pkg/discovery/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/pkg/es/client/package_test.go b/pkg/es/client/package_test.go index 1512ba3d95c..4181943eb3d 100644 --- a/pkg/es/client/package_test.go +++ b/pkg/es/client/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/pkg/es/filter/package_test.go b/pkg/es/filter/package_test.go index 3c4b28b78ac..d0643a88594 100644 --- a/pkg/es/filter/package_test.go +++ b/pkg/es/filter/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/pkg/healthcheck/package_test.go b/pkg/healthcheck/package_test.go index 11cf8a259ce..4da8b594261 100644 --- a/pkg/healthcheck/package_test.go +++ b/pkg/healthcheck/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/pkg/tenancy/package_test.go b/pkg/tenancy/package_test.go index bae65a28a8d..8fb8984f481 100644 --- a/pkg/tenancy/package_test.go +++ b/pkg/tenancy/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/metrics/disabled/package_test.go b/plugin/metrics/disabled/package_test.go index e451f6bcd64..1877be9fbb6 100644 --- a/plugin/metrics/disabled/package_test.go +++ b/plugin/metrics/disabled/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/metrics/package_test.go b/plugin/metrics/package_test.go index 33a11e122fc..e98f5bce5e9 100644 --- a/plugin/metrics/package_test.go +++ b/plugin/metrics/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/sampling/calculationstrategy/package_test.go b/plugin/sampling/calculationstrategy/package_test.go index 1f5390a1cca..7d9efa7120b 100644 --- a/plugin/sampling/calculationstrategy/package_test.go +++ b/plugin/sampling/calculationstrategy/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/sampling/strategystore/package_test.go b/plugin/sampling/strategystore/package_test.go index 38c7f32d208..5a7963d512a 100644 --- a/plugin/sampling/strategystore/package_test.go +++ b/plugin/sampling/strategystore/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/storage/blackhole/package_test.go b/plugin/storage/blackhole/package_test.go index 3ddbe46be3a..1136d3ae302 100644 --- a/plugin/storage/blackhole/package_test.go +++ b/plugin/storage/blackhole/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/storage/cassandra/dependencystore/package_test.go b/plugin/storage/cassandra/dependencystore/package_test.go index 4897ac87426..4c775041dc9 100644 --- a/plugin/storage/cassandra/dependencystore/package_test.go +++ b/plugin/storage/cassandra/dependencystore/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/storage/cassandra/package_test.go b/plugin/storage/cassandra/package_test.go index 64ae017b738..12ba121f44a 100644 --- a/plugin/storage/cassandra/package_test.go +++ b/plugin/storage/cassandra/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/storage/cassandra/spanstore/dbmodel/package_test.go b/plugin/storage/cassandra/spanstore/dbmodel/package_test.go index fc35bc448b1..b7ad360ab64 100644 --- a/plugin/storage/cassandra/spanstore/dbmodel/package_test.go +++ b/plugin/storage/cassandra/spanstore/dbmodel/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/storage/cassandra/spanstore/package_test.go b/plugin/storage/cassandra/spanstore/package_test.go index d818e591213..6212c985ef1 100644 --- a/plugin/storage/cassandra/spanstore/package_test.go +++ b/plugin/storage/cassandra/spanstore/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/storage/es/spanstore/dbmodel/package_test.go b/plugin/storage/es/spanstore/dbmodel/package_test.go index fc35bc448b1..b7ad360ab64 100644 --- a/plugin/storage/es/spanstore/dbmodel/package_test.go +++ b/plugin/storage/es/spanstore/dbmodel/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/storage/es/spanstore/package_test.go b/plugin/storage/es/spanstore/package_test.go index d818e591213..6212c985ef1 100644 --- a/plugin/storage/es/spanstore/package_test.go +++ b/plugin/storage/es/spanstore/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/storage/grpc/package_test.go b/plugin/storage/grpc/package_test.go index e7ec28386a1..0a7103d2b21 100644 --- a/plugin/storage/grpc/package_test.go +++ b/plugin/storage/grpc/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/storage/grpc/shared/package_test.go b/plugin/storage/grpc/shared/package_test.go index 192c10775b0..a611e311553 100644 --- a/plugin/storage/grpc/shared/package_test.go +++ b/plugin/storage/grpc/shared/package_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/storage/integration/package_test.go b/plugin/storage/integration/package_test.go index 063ff28340c..8a105f856df 100644 --- a/plugin/storage/integration/package_test.go +++ b/plugin/storage/integration/package_test.go @@ -1,3 +1,17 @@ +// 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 integration import ( diff --git a/scripts/check-goleak-files.sh b/scripts/check-goleak-files.sh index c9e371ba6e3..cd51dadb23f 100755 --- a/scripts/check-goleak-files.sh +++ b/scripts/check-goleak-files.sh @@ -10,9 +10,6 @@ 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 From 6b4094b6bbf73ddd4b5c00a1cb1482b022df8d02 Mon Sep 17 00:00:00 2001 From: Harshvir Potpose Date: Fri, 22 Dec 2023 01:16:27 +0530 Subject: [PATCH 4/5] bug fix in goleak script Signed-off-by: Harshvir Potpose --- scripts/check-goleak-files.sh | 3 +++ 1 file changed, 3 insertions(+) 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 From 9a0252269fb47bf8d02e631c7fb55ddd78d76ecf Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Thu, 21 Dec 2023 15:28:44 -0500 Subject: [PATCH 5/5] rm ./plugin/storage/integration/package_test.go Signed-off-by: Yuri Shkuro --- plugin/storage/integration/package_test.go | 25 ---------------------- 1 file changed, 25 deletions(-) delete mode 100644 plugin/storage/integration/package_test.go diff --git a/plugin/storage/integration/package_test.go b/plugin/storage/integration/package_test.go deleted file mode 100644 index 8a105f856df..00000000000 --- a/plugin/storage/integration/package_test.go +++ /dev/null @@ -1,25 +0,0 @@ -// 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 integration - -import ( - "testing" - - "go.uber.org/goleak" -) - -func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) -}