(t *testing.T)
| 335 | } |
| 336 | |
| 337 | func TestExecContextFailureWithoutCancelation(t *testing.T) { |
| 338 | t.Parallel() |
| 339 | |
| 340 | ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) |
| 341 | defer cancel() |
| 342 | |
| 343 | pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { |
| 344 | ctx, cancelFunc := context.WithCancel(ctx) |
| 345 | defer cancelFunc() |
| 346 | |
| 347 | _, err := conn.Exec(ctx, "selct;") |
| 348 | if err == nil { |
| 349 | t.Fatal("Expected SQL syntax error") |
| 350 | } |
| 351 | assert.False(t, pgconn.SafeToRetry(err)) |
| 352 | |
| 353 | rows, _ := conn.Query(context.Background(), "select 1") |
| 354 | rows.Close() |
| 355 | if rows.Err() != nil { |
| 356 | t.Fatalf("ExecEx failure appears to have broken connection: %v", rows.Err()) |
| 357 | } |
| 358 | assert.False(t, pgconn.SafeToRetry(err)) |
| 359 | }) |
| 360 | } |
| 361 | |
| 362 | func TestExecContextFailureWithoutCancelationWithArguments(t *testing.T) { |
| 363 | t.Parallel() |
nothing calls this directly
no test coverage detected