Skip to content

Commit 5e17499

Browse files
committed
parallelize TestContextBeginReadOnly
1 parent d7650a1 commit 5e17499

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

driver_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2944,8 +2944,8 @@ func TestContextBeginIsolationLevel(t *testing.T) {
29442944
}
29452945

29462946
func TestContextBeginReadOnly(t *testing.T) {
2947-
runTests(t, dsn, func(dbt *DBTest) {
2948-
dbt.mustExec("CREATE TABLE test (v INTEGER)")
2947+
runTestsParallel(t, dsn, func(dbt *DBTest, tbl string) {
2948+
dbt.mustExec("CREATE TABLE " + tbl + " (v INTEGER)")
29492949
ctx, cancel := context.WithCancel(context.Background())
29502950
defer cancel()
29512951

@@ -2960,14 +2960,14 @@ func TestContextBeginReadOnly(t *testing.T) {
29602960
}
29612961

29622962
// INSERT queries fail in a READ ONLY transaction.
2963-
_, err = tx.ExecContext(ctx, "INSERT INTO test VALUES (1)")
2963+
_, err = tx.ExecContext(ctx, "INSERT INTO "+tbl+" VALUES (1)")
29642964
if _, ok := err.(*MySQLError); !ok {
29652965
dbt.Errorf("expected MySQLError, got %v", err)
29662966
}
29672967

29682968
// SELECT queries can be executed.
29692969
var v int
2970-
row := tx.QueryRowContext(ctx, "SELECT COUNT(*) FROM test")
2970+
row := tx.QueryRowContext(ctx, "SELECT COUNT(*) FROM "+tbl)
29712971
if err := row.Scan(&v); err != nil {
29722972
dbt.Fatal(err)
29732973
}

0 commit comments

Comments
 (0)