Skip to content

Test the lost-transaction refusal on PostgreSQL too - #1782

Merged
dimitri-yatsenko merged 2 commits into
masterfrom
test/1775-lost-transaction-both-backends
Dec 1, 2026
Merged

dimitri-yatsenko merged 2 commits into
masterfrom
test/1775-lost-transaction-both-backends

Conversation

@dimitri-yatsenko

Copy link
Copy Markdown
Member

Follow-up to #1777 and #1778.

test_transaction_lost_with_connection_is_not_continued checked the outcome only on MySQL, because PostgreSQL raised the driver's error and did not reconnect until #1776 was fixed. With #1778 merged, PostgreSQL raises LostConnectionError ("during a transaction"), clears the transaction flag, and reconnects on the next query, so the test now checks this on both backends.

Test-only change. tests/integration/test_connection_liveness.py and the reconnect tests pass locally on MySQL and PostgreSQL (27 passed).

With #1778, PostgreSQL maps a dropped connection to LostConnectionError and
reconnects, so the MySQL-only guard in
test_transaction_lost_with_connection_is_not_continued is no longer needed.

@MilagrosMarin MilagrosMarin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dimitri-yatsenko. With #1778 in, dropping the MySQL-only branch makes sense, and narrowing pytest.raises(Exception) to LostConnectionError with match="during a transaction" makes the test stricter on both backends. The outcome checks (in_transaction cleared, next query reconnects) now cover PostgreSQL as well.

Approving.

@dimitri-yatsenko
dimitri-yatsenko merged commit f54e1e1 into master Dec 1, 2026
25 checks passed
@dimitri-yatsenko
dimitri-yatsenko deleted the test/1775-lost-transaction-both-backends branch December 1, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants