From: Daniele Varrazzo Date: Sun, 5 Jun 2022 17:30:41 +0000 (+0200) Subject: test(crdb): skip transaction tests, deadlocking on CRDB X-Git-Tag: 3.1~49^2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9f23c0d199261105e3be80e18d75e38784b63ef;p=thirdparty%2Fpsycopg.git test(crdb): skip transaction tests, deadlocking on CRDB I guess is it something related to rows locks and rollback. Will ask upstream. --- diff --git a/tests/test_transaction.py b/tests/test_transaction.py index 4879a86d4..1c03540aa 100644 --- a/tests/test_transaction.py +++ b/tests/test_transaction.py @@ -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. diff --git a/tests/test_transaction_async.py b/tests/test_transaction_async.py index 4533afa5e..cdaba9df3 100644 --- a/tests/test_transaction_async.py +++ b/tests/test_transaction_async.py @@ -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.