initConnOnMockServer dials srv, puts the connection into INITIALIZING and runs c.initConn against it. It returns the error from initConn (if any).
(t *testing.T, c *baseClient, srv interface{ Addr() string })
| 224 | // initConnOnMockServer dials srv, puts the connection into INITIALIZING and |
| 225 | // runs c.initConn against it. It returns the error from initConn (if any). |
| 226 | func initConnOnMockServer(t *testing.T, c *baseClient, srv interface{ Addr() string }) error { |
| 227 | t.Helper() |
| 228 | netConn, err := net.DialTimeout("tcp", srv.Addr(), 2*time.Second) |
| 229 | if err != nil { |
| 230 | t.Fatalf("failed to dial mock server: %v", err) |
| 231 | } |
| 232 | t.Cleanup(func() { _ = netConn.Close() }) |
| 233 | cn := pool.NewConn(netConn) |
| 234 | cn.GetStateMachine().Transition(pool.StateInitializing) |
| 235 | return c.initConn(context.Background(), cn) |
| 236 | } |
| 237 | |
| 238 | // newTestBaseClient builds a baseClient wired up with hooks for use in |
| 239 | // tests that exercise initConn directly. |
no test coverage detected