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

Function TestPingErrInvalidConn

connection_test.go:160–175  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

158}
159
160func TestPingErrInvalidConn(t *testing.T) {
161 nc := badConnection{err: errors.New("failed to write"), n: 10}
162 mc := &mysqlConn{
163 netConn: nc,
164 buf: newBuffer(),
165 maxAllowedPacket: defaultMaxAllowedPacket,
166 closech: make(chan struct{}),
167 cfg: NewConfig(),
168 }
169
170 err := mc.Ping(context.Background())
171
172 if err != nc.err {
173 t.Errorf("expected %#v, got %#v", nc.err, err)
174 }
175}
176
177type badConnection struct {
178 n int

Callers

nothing calls this directly

Calls 3

PingMethod · 0.95
newBufferFunction · 0.85
NewConfigFunction · 0.85

Tested by

no test coverage detected