Skip to content
Closed
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
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ require (
github.com/valyala/fasttemplate v1.0.1 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,8 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
Expand Down Expand Up @@ -1103,6 +1105,7 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8=
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
3 changes: 3 additions & 0 deletions go/cache/ristretto/bloom/bbloom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"os"
"testing"

"go.uber.org/goleak"

"vitess.io/vitess/go/hack"
)

Expand All @@ -16,6 +18,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
wordlist1 = make([][]byte, n)
for i := range wordlist1 {
b := make([]byte, 32)
Expand Down
1 change: 1 addition & 0 deletions go/cmd/vtclient/vtclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ func execMulti(ctx context.Context, db *sql.DB, sql string) (*results, error) {
if isThrottled {
tickDuration := time.Second / time.Duration(*qps)
ticker = time.NewTicker(tickDuration)
defer ticker.Stop()
}

for j := 0; j < *count; j++ {
Expand Down
3 changes: 3 additions & 0 deletions go/mysql/collations/integration/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"strings"
"testing"

"go.uber.org/goleak"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/vt/vttest"

Expand Down Expand Up @@ -55,6 +57,7 @@ func mysqlconn(t *testing.T) *mysql.Conn {
}

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
flag.Parse()

exitCode := func() int {
Expand Down
2 changes: 1 addition & 1 deletion go/mysql/collations/tools/makecolldata/contractions.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func printContraction1(g *codegen.Generator, wa *weightarray, incont []uca.Contr
trie[r] = append(trie[r], cont)
}
if depth == len(cont.Path) {
leaf = &cont
leaf = &cont // nolint:exportloopref
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed differently by @dbussink in #10765

}
}

Expand Down
3 changes: 3 additions & 0 deletions go/mysql/endtoend/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"strings"
"testing"

"go.uber.org/goleak"

"vitess.io/vitess/go/mysql"
vtenv "vitess.io/vitess/go/vt/env"
"vitess.io/vitess/go/vt/mysqlctl"
Expand Down Expand Up @@ -169,6 +171,7 @@ func binaryPath(root, binary string) (string, error) {
}

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
flag.Parse() // Do not remove this comment, import into google3 depends on it

exitCode := func() int {
Expand Down
3 changes: 3 additions & 0 deletions go/stats/prometheusbackend/prometheusbackend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"testing"
"time"

"go.uber.org/goleak"

"vitess.io/vitess/go/stats"

"github.com/prometheus/client_golang/prometheus/promhttp"
Expand Down Expand Up @@ -358,6 +360,7 @@ func testMetricsHandler(t *testing.T) *httptest.ResponseRecorder {
}

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
Init(namespace)
os.Exit(m.Run())
}
7 changes: 6 additions & 1 deletion go/test/endtoend/backup/transform/backup_transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ limitations under the License.

package transform

import "testing"
import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
TestMainSetup(m, false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ package mysqlctld
import (
"testing"

"go.uber.org/goleak"

"vitess.io/vitess/go/test/endtoend/backup/transform"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
transform.TestMainSetup(m, true)
}

Expand Down
3 changes: 3 additions & 0 deletions go/test/endtoend/backup/vtbackup/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"path"
"testing"

"go.uber.org/goleak"

"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/vt/log"
)
Expand Down Expand Up @@ -53,6 +55,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
2 changes: 2 additions & 0 deletions go/test/endtoend/cellalias/cell_alias_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (

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

"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/test/endtoend/cluster"
Expand Down Expand Up @@ -92,6 +93,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
1 change: 1 addition & 0 deletions go/test/endtoend/cluster/vttablet_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ func (vttablet *VttabletProcess) GetStatusDetails() string {
// WaitForStatus waits till desired status of tablet is reached
func (vttablet *VttabletProcess) WaitForStatus(status string, howLong time.Duration) bool {
ticker := time.NewTicker(howLong)
defer ticker.Stop()
for range ticker.C {
if vttablet.GetTabletStatus() == status {
return true
Expand Down
3 changes: 3 additions & 0 deletions go/test/endtoend/clustertest/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"os"
"testing"

"go.uber.org/goleak"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/test/endtoend/cluster"
)
Expand Down Expand Up @@ -60,6 +62,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
2 changes: 2 additions & 0 deletions go/test/endtoend/keyspace/keyspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

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

"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/vt/proto/topodata"
Expand Down Expand Up @@ -79,6 +80,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
3 changes: 3 additions & 0 deletions go/test/endtoend/messaging/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"os"
"testing"

"go.uber.org/goleak"

"vitess.io/vitess/go/test/endtoend/cluster"
_ "vitess.io/vitess/go/vt/vtgate/grpcvtgateconn"
)
Expand Down Expand Up @@ -104,6 +106,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
2 changes: 2 additions & 0 deletions go/test/endtoend/mysqlctl/mysqlctl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"testing"

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

"vitess.io/vitess/go/test/endtoend/cluster"
)
Expand All @@ -39,6 +40,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
2 changes: 2 additions & 0 deletions go/test/endtoend/mysqlctld/mysqlctld_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"testing"

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

"vitess.io/vitess/go/test/endtoend/cluster"
)
Expand All @@ -38,6 +39,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
3 changes: 3 additions & 0 deletions go/test/endtoend/mysqlserver/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"strconv"
"testing"

"go.uber.org/goleak"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/test/endtoend/cluster"
)
Expand Down Expand Up @@ -61,6 +63,7 @@ END;
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"testing"
"time"

"go.uber.org/goleak"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/schema"
Expand Down Expand Up @@ -201,6 +203,7 @@ const (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
3 changes: 3 additions & 0 deletions go/test/endtoend/onlineddl/ghost/onlineddl_ghost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
"testing"
"time"

"go.uber.org/goleak"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/vt/schema"

Expand Down Expand Up @@ -146,6 +148,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
3 changes: 3 additions & 0 deletions go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (
"testing"
"time"

"go.uber.org/goleak"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/schema"
Expand Down Expand Up @@ -185,6 +187,7 @@ const (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"testing"
"time"

"go.uber.org/goleak"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/vt/schema"

Expand Down Expand Up @@ -184,6 +186,7 @@ var testCases = []testCase{
}

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"testing"
"time"

"go.uber.org/goleak"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/vt/schema"
"vitess.io/vitess/go/vt/sqlparser"
Expand Down Expand Up @@ -84,6 +86,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"testing"
"time"

"go.uber.org/goleak"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/vt/schema"

Expand Down Expand Up @@ -82,6 +84,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
3 changes: 3 additions & 0 deletions go/test/endtoend/onlineddl/vrepl/onlineddl_vrepl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"testing"
"time"

"go.uber.org/goleak"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/test/endtoend/onlineddl"
Expand Down Expand Up @@ -152,6 +154,7 @@ var (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
defer cluster.PanicHandler(nil)
flag.Parse()

Expand Down
Loading