Skip to content

Commit

Permalink
add lock to flaky TestValidateVersionShard test
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
  • Loading branch information
timvaillancourt committed May 21, 2024
1 parent 521fc3a commit d512ec2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions go/vt/vtctl/grpcvtctldserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"io"
"sort"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -11334,7 +11335,9 @@ func TestValidateVersionShard(t *testing.T) {
expected: &vtctldatapb.ValidateVersionShardResponse{
Results: []string{},
},
setup: func() {
setup: func(testSetupMu *sync.Mutex) {

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11338 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal
testSetupMu.Lock()
defer testSetupMu.Unlock()
addrVersionMap := map[string]string{
"primary:0": "version1",
"replica:0": "version1",
Expand All @@ -11352,7 +11355,9 @@ func TestValidateVersionShard(t *testing.T) {
expected: &vtctldatapb.ValidateVersionShardResponse{
Results: []string{"primary zone1-0000000100 version version1 is different than replica zone1-0000000101 version version:\"version2\""},
},
setup: func() {
setup: func(testSetupMu *sync.Mutex) {

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal

Check failure on line 11358 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

cannot use func(testSetupMu *sync.Mutex) {…} (value of type func(testSetupMu *sync.Mutex)) as func() value in struct literal
testSetupMu.Lock()
defer testSetupMu.Unlock()
addrVersionMap := map[string]string{
"primary:0": "version1",
"replica:0": "version2",
Expand All @@ -11363,12 +11368,13 @@ func TestValidateVersionShard(t *testing.T) {
},
}

var testSetupMu sync.Mutex
for _, tt := range tests {
curT := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

curT.setup()
curT.setup(&testSetupMu)

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / test

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

too many arguments in call to curT.setup

Check failure on line 11377 in go/vt/vtctl/grpcvtctldserver/server_test.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

too many arguments in call to curT.setup
resp, err := vtctld.ValidateVersionShard(ctx, curT.req)
if curT.shouldErr {
assert.Error(t, err)
Expand Down

0 comments on commit d512ec2

Please sign in to comment.