(t *testing.T)
| 16 | ) |
| 17 | |
| 18 | func TestStaleConnectionChecks(t *testing.T) { |
| 19 | runTestsParallel(t, dsn, func(dbt *DBTest, _ string) { |
| 20 | dbt.mustExec("SET @@SESSION.wait_timeout = 2") |
| 21 | |
| 22 | if err := dbt.db.Ping(); err != nil { |
| 23 | dbt.Fatal(err) |
| 24 | } |
| 25 | |
| 26 | // wait for MySQL to close our connection |
| 27 | time.Sleep(3 * time.Second) |
| 28 | |
| 29 | tx, err := dbt.db.Begin() |
| 30 | if err != nil { |
| 31 | dbt.Fatal(err) |
| 32 | } |
| 33 | |
| 34 | if err := tx.Rollback(); err != nil { |
| 35 | dbt.Fatal(err) |
| 36 | } |
| 37 | }) |
| 38 | } |
nothing calls this directly
no test coverage detected