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

Function TestExecContextFailureWithoutCancelationWithArguments

conn_test.go:362–378  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

360}
361
362func TestExecContextFailureWithoutCancelationWithArguments(t *testing.T) {
363 t.Parallel()
364
365 ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
366 defer cancel()
367
368 pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
369 ctx, cancelFunc := context.WithCancel(ctx)
370 defer cancelFunc()
371
372 _, err := conn.Exec(ctx, "selct $1;", 1)
373 if err == nil {
374 t.Fatal("Expected SQL syntax error")
375 }
376 assert.False(t, pgconn.SafeToRetry(err))
377 })
378}
379
380func TestExecFailureCloseBefore(t *testing.T) {
381 t.Parallel()

Callers

nothing calls this directly

Calls 3

RunWithQueryExecModesFunction · 0.92
SafeToRetryFunction · 0.92
ExecMethod · 0.65

Tested by

no test coverage detected