Skip to content

Commit

Permalink
introduce runTestsParallel to TestContextCancelBegin
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo82148 committed Oct 7, 2023
1 parent 3cbe366 commit a92ff22
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2832,8 +2832,8 @@ func TestContextCancelBegin(t *testing.T) {
t.Skip(`FIXME: it sometime fails with "expected driver.ErrBadConn, got sql: connection is already closed" on windows and macOS`)
}

runTests(t, dsn, func(dbt *DBTest) {
dbt.mustExec("CREATE TABLE test (v INTEGER)")
runTestsParallel(t, dsn, func(dbt *DBTest, tbl string) {
dbt.mustExec("CREATE TABLE " + tbl + " (v INTEGER)")
ctx, cancel := context.WithCancel(context.Background())
conn, err := dbt.db.Conn(ctx)
if err != nil {
Expand All @@ -2850,7 +2850,7 @@ func TestContextCancelBegin(t *testing.T) {

// This query will be canceled.
startTime := time.Now()
if _, err := tx.ExecContext(ctx, "INSERT INTO test VALUES (SLEEP(1))"); err != context.Canceled {
if _, err := tx.ExecContext(ctx, "INSERT INTO "+tbl+" VALUES (SLEEP(1))"); err != context.Canceled {
dbt.Errorf("expected context.Canceled, got %v", err)
}
if d := time.Since(startTime); d > 500*time.Millisecond {
Expand Down

0 comments on commit a92ff22

Please sign in to comment.