Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Apr 20, 2023
1 parent aa2c6f6 commit 106ae56
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions planner/core/plan_cache_param_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,18 @@ func TestGetParamSQLFromASTConcurrently(t *testing.T) {
var wg sync.WaitGroup
for i := 0; i < n; i++ {
wg.Add(1)
go func() {
go func(id int) {
for i := 0; i < 1000; i++ {
idx := rand.Intn(n)
_, vals, err := GetParamSQLFromAST(context.Background(), MockContext(), stmts[idx])
_, vals, err := GetParamSQLFromAST(context.Background(), MockContext(), stmts[id])
require.Nil(t, err)
require.Equal(t, len(vals), 3)
require.Equal(t, vals[0].GetValue(), int64(idx*3+0))
require.Equal(t, vals[1].GetValue(), int64(idx*3+1))
require.Equal(t, vals[2].GetValue(), int64(idx*3+2))
require.Equal(t, vals[0].GetValue(), int64(id*3+0))
require.Equal(t, vals[1].GetValue(), int64(id*3+1))
require.Equal(t, vals[2].GetValue(), int64(id*3+2))
time.Sleep(time.Millisecond + time.Duration(rand.Intn(int(time.Millisecond))))
}
wg.Done()
}()
}(i)
}
wg.Wait()
}
Expand Down

0 comments on commit 106ae56

Please sign in to comment.