(t *testing.T)
| 718 | } |
| 719 | |
| 720 | func TestConnBeginTxReadOnly(t *testing.T) { |
| 721 | testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) { |
| 722 | tx, err := db.BeginTx(context.Background(), &sql.TxOptions{ReadOnly: true}) |
| 723 | require.NoError(t, err) |
| 724 | defer tx.Rollback() |
| 725 | |
| 726 | var pgReadOnly string |
| 727 | err = tx.QueryRow("show transaction_read_only").Scan(&pgReadOnly) |
| 728 | if err != nil { |
| 729 | t.Errorf("QueryRow failed: %v", err) |
| 730 | } |
| 731 | |
| 732 | if pgReadOnly != "on" { |
| 733 | t.Errorf("pgReadOnly => %s, want %s", pgReadOnly, "on") |
| 734 | } |
| 735 | }) |
| 736 | } |
| 737 | |
| 738 | func TestBeginTxContextCancel(t *testing.T) { |
| 739 | testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) { |
nothing calls this directly
no test coverage detected