Skip to content

Commit

Permalink
Nits
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Jan 15, 2025
1 parent f5c6c63 commit 9a19131
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions go/test/endtoend/vtgate/vschema/vschema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ func TestVSchemaSQLAPIConcurrency(t *testing.T) {
if !utils.BinaryIsAtLeastAtVersion(22, "vtgate") {
t.Skip("This test requires vtgate version 22 or higher")
}

ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
defer cancel()
conn, err := mysql.Connect(ctx, &vtParams)
Expand All @@ -214,6 +215,7 @@ func TestVSchemaSQLAPIConcurrency(t *testing.T) {
}

isVersionMismatchErr := func(err error) bool {
// The error we get is an SQL error so we have to do string matching.
return err != nil && strings.Contains(err.Error(), vtgate.ErrStaleVSchema.Error())
}

Expand All @@ -226,14 +228,12 @@ func TestVSchemaSQLAPIConcurrency(t *testing.T) {
time.Sleep(time.Duration(rand.Intn(100) * int(time.Nanosecond)))
tableName := fmt.Sprintf("%s%d", baseTableName, i)
_, err = mysqlConns[i].ExecuteFetch(fmt.Sprintf("ALTER VSCHEMA ADD TABLE %s", tableName), -1, false)
// The error we get is an SQL error so we have to do string matching.
if isVersionMismatchErr(err) {
preventedLostWrites.Store(true)
} else {
require.NoError(t, err)
time.Sleep(time.Duration(rand.Intn(75) * int(time.Nanosecond)))
_, err = mysqlConns[i].ExecuteFetch(fmt.Sprintf("ALTER VSCHEMA DROP TABLE %s", tableName), -1, false)
// The error we get is an SQL error so we have to do string matching.
if isVersionMismatchErr(err) {
preventedLostWrites.Store(true)
} else {
Expand Down

0 comments on commit 9a19131

Please sign in to comment.