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

Function TestConnQueryCloseEarlyWithErrorOnWire

query_test.go:381–395  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

379}
380
381func TestConnQueryCloseEarlyWithErrorOnWire(t *testing.T) {
382 t.Parallel()
383
384 conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE"))
385 defer closeConn(t, conn)
386
387 rows, err := conn.Query(context.Background(), "select 1/(10-n) from generate_series(1,10) n")
388 if err != nil {
389 t.Fatalf("conn.Query failed: %v", err)
390 }
391 assert.False(t, pgconn.SafeToRetry(err))
392 rows.Close()
393
394 ensureConnValid(t, conn)
395}
396
397// Test that a connection stays valid when query results read incorrectly
398func TestConnQueryReadWrongTypeError(t *testing.T) {

Callers

nothing calls this directly

Calls 6

SafeToRetryFunction · 0.92
mustConnectStringFunction · 0.85
closeConnFunction · 0.70
ensureConnValidFunction · 0.70
QueryMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected