You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If BeginTx (or BeginTxFunc) is called with unexpected options, ExpectationsWereMet deadlocks if called afterwards.
To Reproduce
In the example use db.BeginTx(context.Background(), pgx.TxOptions{IsoLevel: pgx.Serializable}) instead of db.Begin (requires adding BeginTx(context.Context, pgx.TxOptions) (pgx.Tx, error) to the PgxIface). Run tests.
Expected behavior
Error return from ExpectationsWereMet
Describe the bug
If
BeginTx
(orBeginTxFunc
) is called with unexpected options,ExpectationsWereMet
deadlocks if called afterwards.To Reproduce
In the example use
db.BeginTx(context.Background(), pgx.TxOptions{IsoLevel: pgx.Serializable})
instead ofdb.Begin
(requires addingBeginTx(context.Context, pgx.TxOptions) (pgx.Tx, error)
to thePgxIface
). Run tests.Expected behavior
Error return from
ExpectationsWereMet
Additional context
The problem seems to be here:
pgxmock/pgxmock.go
Lines 513 to 517 in ed5a923
Here
expected.Unlock()
is not called ifexpected.opts != txOptions
.The text was updated successfully, but these errors were encountered: