Skip to content

Commit

Permalink
go1.22: remove outdated loopclosure captures in tests (#15227)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Mason <andrew@planetscale.com>
  • Loading branch information
Andrew Mason committed Feb 14, 2024
1 parent fa59f9d commit 4b100ea
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
16 changes: 8 additions & 8 deletions go/vt/vtctl/grpcvtctldserver/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ import (

"vitess.io/vitess/go/protoutil"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/vtctl/schematools"

"vitess.io/vitess/go/test/utils"
"vitess.io/vitess/go/vt/vtctl/schematools"

vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata"
"vitess.io/vitess/go/vt/proto/vttime"
vttimepb "vitess.io/vitess/go/vt/proto/vttime"
)

var now = time.Now()
Expand Down Expand Up @@ -86,7 +85,6 @@ func TestRowToSchemaMigration(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
out, err := rowToSchemaMigration(test.row)
if test.shouldErr {
Expand All @@ -110,7 +108,7 @@ func TestValueToVTTime(t *testing.T) {
tests := []struct {
name string
value string
expected *vttime.Time
expected *vttimepb.Time
shouldErr bool
}{
{
Expand All @@ -130,7 +128,6 @@ func TestValueToVTTime(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

Expand All @@ -153,7 +150,7 @@ func TestValueToVTDuration(t *testing.T) {
name string
value string
defaultUnit string
expected *vttime.Duration
expected *vttimepb.Duration
shouldErr bool
}{
{
Expand Down Expand Up @@ -182,7 +179,6 @@ func TestValueToVTDuration(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
out, err := valueToVTDuration(test.value, test.defaultUnit)
if test.shouldErr {
Expand All @@ -197,6 +193,8 @@ func TestValueToVTDuration(t *testing.T) {
}

func TestAlterSchemaMigrationQuery(t *testing.T) {
t.Parallel()

uuid := "4e5dcf80_354b_11eb_82cd_f875a4d24e90"

tcases := []struct {
Expand Down Expand Up @@ -228,6 +226,8 @@ func TestAlterSchemaMigrationQuery(t *testing.T) {
for _, tcase := range tcases {
testName := fmt.Sprintf("%s %s", tcase.command, tcase.uuid)
t.Run(testName, func(t *testing.T) {
t.Parallel()

query, err := alterSchemaMigrationQuery(tcase.command, tcase.uuid)
assert.NoError(t, err)
assert.Equal(t, tcase.expect, query)
Expand Down
19 changes: 11 additions & 8 deletions go/vt/vtctl/grpcvtctldserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1426,8 +1426,8 @@ func TestCancelSchemaMigration(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down Expand Up @@ -1930,6 +1930,8 @@ func TestCleanupSchemaMigration(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ts := memorytopo.NewServer(ctx, "zone1")
Expand Down Expand Up @@ -2132,6 +2134,8 @@ func TestForceCutOverSchemaMigration(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ts := memorytopo.NewServer(ctx, "zone1")
Expand Down Expand Up @@ -2333,11 +2337,11 @@ func TestCompleteSchemaMigration(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

ctx, Complete := context.WithCancel(context.Background())
defer Complete()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ts := memorytopo.NewServer(ctx, "zone1")

testutil.AddTablets(ctx, t, ts, &testutil.AddTabletOptions{
Expand Down Expand Up @@ -5998,7 +6002,6 @@ func TestGetSchemaMigrations(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -7664,11 +7667,11 @@ func TestLaunchSchemaMigration(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

ctx, Launch := context.WithCancel(context.Background())
defer Launch()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ts := memorytopo.NewServer(ctx, "zone1")

testutil.AddTablets(ctx, t, ts, &testutil.AddTabletOptions{
Expand Down
1 change: 0 additions & 1 deletion go/vt/vttablet/tabletserver/tabletenv/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ func TestVerifyTxThrottlerConfig(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.Name, func(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit 4b100ea

Please sign in to comment.