Skip to content

Commit

Permalink
parallelize TestRawBytesAreNotModified
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo82148 committed Dec 12, 2023
1 parent 987e2b1 commit 91622f0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3225,18 +3225,18 @@ func TestRawBytesAreNotModified(t *testing.T) {
strings.Repeat(strings.ToUpper(blob), blobSize/len(blob)),
}

runTests(t, dsn, func(dbt *DBTest) {
dbt.mustExec("CREATE TABLE test (id int, value BLOB) CHARACTER SET utf8")
runTestsParallel(t, dsn, func(dbt *DBTest, tbl string) {
dbt.mustExec("CREATE TABLE " + tbl + " (id int, value BLOB) CHARACTER SET utf8")
for i := 0; i < insertRows; i++ {
dbt.mustExec("INSERT INTO test VALUES (?, ?)", i+1, sqlBlobs[i&1])
dbt.mustExec("INSERT INTO "+tbl+" VALUES (?, ?)", i+1, sqlBlobs[i&1])
}

for i := 0; i < contextRaceIterations; i++ {
func() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

rows, err := dbt.db.QueryContext(ctx, `SELECT id, value FROM test`)
rows, err := dbt.db.QueryContext(ctx, `SELECT id, value FROM `+tbl)
if err != nil {
dbt.Fatal(err)
}
Expand Down

0 comments on commit 91622f0

Please sign in to comment.