MCPcopy
hub / github.com/jackc/pgx / TestConnectWithConnectionRefused

Function TestConnectWithConnectionRefused

pgconn/pgconn_test.go:546–558  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

544}
545
546func TestConnectWithConnectionRefused(t *testing.T) {
547 t.Parallel()
548
549 ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
550 defer cancel()
551
552 // Presumably nothing is listening on 127.0.0.1:1
553 conn, err := pgconn.Connect(ctx, "host=127.0.0.1 port=1")
554 if err == nil {
555 conn.Close(ctx)
556 t.Fatal("Expected error establishing connection to bad port")
557 }
558}
559
560func TestConnectCustomDialer(t *testing.T) {
561 t.Parallel()

Callers

nothing calls this directly

Calls 2

ConnectFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected