Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add goleak check to packages with empty tests #5017

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cmd/collector/app/processor/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package processor

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
12 changes: 8 additions & 4 deletions cmd/collector/app/sampling/model/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@

package model

// import "testing"
import (
"testing"

// func TestNothing(t *testing.T) {
// // just get the code coverage
// }
"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions cmd/collector/app/sampling/strategystore/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package strategystore

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions cmd/ingester/app/builder/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package builder

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions cmd/query/app/ui/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package ui

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 9 additions & 1 deletion empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@

package jaeger

import "testing"
import (
"testing"

"go.uber.org/goleak"
)

func TestDummy(t *testing.T) {
// This is a dummy test in the root package.
// Without it `go test -v .` prints "testing: warning: no tests to run".
}

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions model/json/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package json

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions pkg/cassandra/config/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package config

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions pkg/cassandra/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package cassandra

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions pkg/cassandra/gocql/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package gocql

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions pkg/distributedlock/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package distributedlock

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions pkg/es/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package es

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions pkg/es/wrapper/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package eswrapper

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions pkg/kafka/auth/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package auth

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions pkg/kafka/consumer/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package consumer

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions pkg/kafka/producer/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package producer

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions pkg/memory/config/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package config

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions pkg/prometheus/config/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package config

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions plugin/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package plugin

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions plugin/storage/grpc/config/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package config

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
5 changes: 5 additions & 0 deletions ports/ports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"go.uber.org/goleak"
)

func TestPortToHostPort(t *testing.T) {
Expand Down Expand Up @@ -51,3 +52,7 @@ func TestFormatHostPort(t *testing.T) {
assert.Equal(t, "", FormatHostPort(""))
assert.Equal(t, "localhost:42", FormatHostPort("localhost:42"))
}

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions storage/dependencystore/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package dependencystore

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions storage/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package storage

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions storage/metricsstore/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package metricsstore

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
5 changes: 5 additions & 0 deletions storage/metricsstore/metrics/decorator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

"github.com/stretchr/testify/assert"
"go.uber.org/goleak"

"github.com/jaegertracing/jaeger/internal/metricstest"
protometrics "github.com/jaegertracing/jaeger/proto-gen/api_v2/metrics"
Expand Down Expand Up @@ -152,3 +153,7 @@ func TestFailingUnderlyingCalls(t *testing.T) {

checkExpectedExistingAndNonExistentCounters(t, counters, wantCounts, gauges, wantExistingKeys, wantNonExistentKeys)
}

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
10 changes: 10 additions & 0 deletions storage/samplingstore/empty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
// limitations under the License.

package samplingstore

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
Loading
Loading