MCPcopy
hub / github.com/go-sql-driver/mysql / TestStaleConnectionChecks

Function TestStaleConnectionChecks

conncheck_test.go:18–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func 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}

Callers

nothing calls this directly

Calls 5

runTestsParallelFunction · 0.85
mustExecMethod · 0.80
PingMethod · 0.80
BeginMethod · 0.80
RollbackMethod · 0.80

Tested by

no test coverage detected