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

Function TestPingMarkBadConnection

connection_test.go:143–158  ·  connection_test.go::TestPingMarkBadConnection
(t *testing.T)

Source from the content-addressed store, hash-verified

141}
142
143func TestPingMarkBadConnection(t *testing.T) {
144 nc := badConnection{err: errors.New("boom")}
145 mc := &mysqlConn{
146 netConn: nc,
147 buf: newBuffer(),
148 maxAllowedPacket: defaultMaxAllowedPacket,
149 closech: make(chan struct{}),
150 cfg: NewConfig(),
151 }
152
153 err := mc.Ping(context.Background())
154
155 if err != driver.ErrBadConn {
156 t.Errorf("expected driver.ErrBadConn, got %#v", err)
157 }
158}
159
160func TestPingErrInvalidConn(t *testing.T) {
161 nc := badConnection{err: errors.New("failed to write"), n: 10}

Callers

nothing calls this directly

Calls 3

PingMethod · 0.95
newBufferFunction · 0.85
NewConfigFunction · 0.85

Tested by

no test coverage detected