(t *testing.T)
| 374 | } |
| 375 | |
| 376 | func TestBeginTxBeginQuery(t *testing.T) { |
| 377 | t.Parallel() |
| 378 | |
| 379 | ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) |
| 380 | defer cancel() |
| 381 | |
| 382 | pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { |
| 383 | tx, err := conn.BeginTx(ctx, pgx.TxOptions{BeginQuery: "begin read only"}) |
| 384 | require.NoError(t, err) |
| 385 | defer tx.Rollback(ctx) |
| 386 | |
| 387 | var readOnly bool |
| 388 | conn.QueryRow(ctx, "select current_setting('transaction_read_only')::bool").Scan(&readOnly) |
| 389 | require.True(t, readOnly) |
| 390 | |
| 391 | err = tx.Rollback(ctx) |
| 392 | require.NoError(t, err) |
| 393 | }) |
| 394 | } |
| 395 | |
| 396 | func TestTxNestedTransactionCommit(t *testing.T) { |
| 397 | t.Parallel() |
nothing calls this directly
no test coverage detected