]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test(crdb): skip transaction tests, deadlocking on CRDB
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 5 Jun 2022 17:30:41 +0000 (19:30 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 12 Jul 2022 11:58:34 +0000 (12:58 +0100)
I guess is it something related to rows locks and rollback. Will ask
upstream.

tests/test_transaction.py
tests/test_transaction_async.py

index 4879a86d41eb04aafc7b248748af9b173992b518..1c03540aaa5695ff3d987e627ef0fe698733a0cd 100644 (file)
@@ -6,6 +6,11 @@ import pytest
 
 from psycopg import Connection, ProgrammingError, Rollback
 
+# TODOCRDB: is this the expected behaviour?
+crdb_skip_external_observer = pytest.mark.crdb(
+    "skip", reason="deadlock on observer connection"
+)
+
 
 @pytest.fixture
 def conn(conn, pipeline):
@@ -279,6 +284,7 @@ def test_autocommit_off_but_no_tx_started_exception_exit(conn, svcconn):
     assert not inserted(svcconn)
 
 
+@crdb_skip_external_observer
 def test_autocommit_off_and_tx_in_progress_successful_exit(conn, pipeline, svcconn):
     """
     Scenario:
@@ -304,6 +310,7 @@ def test_autocommit_off_and_tx_in_progress_successful_exit(conn, pipeline, svcco
     assert not inserted(svcconn)
 
 
+@crdb_skip_external_observer
 def test_autocommit_off_and_tx_in_progress_exception_exit(conn, pipeline, svcconn):
     """
     Scenario:
@@ -580,6 +587,7 @@ def test_force_rollback_exception_exit(conn, svcconn):
     assert not inserted(svcconn)
 
 
+@crdb_skip_external_observer
 def test_explicit_rollback_discards_changes(conn, svcconn):
     """
     Raising a Rollback exception in the middle of a block exits the block and
@@ -612,6 +620,7 @@ def test_explicit_rollback_discards_changes(conn, svcconn):
     assert_no_rows()
 
 
+@crdb_skip_external_observer
 def test_explicit_rollback_outer_tx_unaffected(conn, svcconn):
     """
     Raising a Rollback exception in the middle of a block does not impact an
@@ -643,6 +652,7 @@ def test_explicit_rollback_of_outer_transaction(conn):
     assert not inserted(conn)
 
 
+@crdb_skip_external_observer
 def test_explicit_rollback_of_enclosing_tx_outer_tx_unaffected(conn, svcconn):
     """
     Rolling-back an enclosing transaction does not impact an outer transaction.
index 4533afa5ec576c700ce42fc8f1e4a01fa13d4ec7..cdaba9df332d82f9baca5eb159c792285002206b 100644 (file)
@@ -6,8 +6,8 @@ import pytest
 from psycopg import AsyncConnection, ProgrammingError, Rollback
 from psycopg._compat import create_task
 
-from .test_transaction import in_transaction, insert_row, inserted
-from .test_transaction import ExpectedException, get_exc_info
+from .test_transaction import in_transaction, insert_row, inserted, get_exc_info
+from .test_transaction import ExpectedException, crdb_skip_external_observer
 from .test_transaction import create_test_table  # noqa  # autouse fixture
 
 pytestmark = pytest.mark.asyncio
@@ -84,6 +84,7 @@ async def test_rollback_on_exception_exit(aconn):
     assert not await inserted(aconn)
 
 
+@pytest.mark.crdb("skip", reason="pg_terminate_backend")
 async def test_context_inerror_rollback_no_clobber(aconn, apipeline, dsn, caplog):
     if apipeline:
         # Only 'aconn' is possibly in pipeline mode, but the transaction and
@@ -107,6 +108,7 @@ async def test_context_inerror_rollback_no_clobber(aconn, apipeline, dsn, caplog
     assert "in rollback" in rec.message
 
 
+@pytest.mark.crdb("skip", reason="copy")
 async def test_context_active_rollback_no_clobber(dsn, caplog):
     caplog.set_level(logging.WARNING, logger="psycopg")
 
@@ -220,6 +222,7 @@ async def test_autocommit_off_but_no_tx_started_exception_exit(aconn, svcconn):
     assert not inserted(svcconn)
 
 
+@crdb_skip_external_observer
 async def test_autocommit_off_and_tx_in_progress_successful_exit(
     aconn, apipeline, svcconn
 ):
@@ -247,6 +250,7 @@ async def test_autocommit_off_and_tx_in_progress_successful_exit(
     assert not inserted(svcconn)
 
 
+@crdb_skip_external_observer
 async def test_autocommit_off_and_tx_in_progress_exception_exit(
     aconn, apipeline, svcconn
 ):
@@ -529,6 +533,7 @@ async def test_force_rollback_exception_exit(aconn, svcconn):
     assert not inserted(svcconn)
 
 
+@crdb_skip_external_observer
 async def test_explicit_rollback_discards_changes(aconn, svcconn):
     """
     Raising a Rollback exception in the middle of a block exits the block and
@@ -561,6 +566,7 @@ async def test_explicit_rollback_discards_changes(aconn, svcconn):
     await assert_no_rows()
 
 
+@crdb_skip_external_observer
 async def test_explicit_rollback_outer_tx_unaffected(aconn, svcconn):
     """
     Raising a Rollback exception in the middle of a block does not impact an
@@ -592,6 +598,7 @@ async def test_explicit_rollback_of_outer_transaction(aconn):
     assert not await inserted(aconn)
 
 
+@crdb_skip_external_observer
 async def test_explicit_rollback_of_enclosing_tx_outer_tx_unaffected(aconn, svcconn):
     """
     Rolling-back an enclosing transaction does not impact an outer transaction.