From a0cb861cda20e1fb939202c868aa9820805064be Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sun, 5 Jun 2022 18:58:37 +0200 Subject: [PATCH] test: add test to reveal unexpected message received The test fails because we receive a notification: message type 0x33 arrived from server while idle See issue #314. --- tests/test_pipeline.py | 12 ++++++++++++ tests/test_pipeline_async.py | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index 841379bb9..dd890f849 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -487,6 +487,18 @@ def test_rollback_transaction(conn): conn.execute("select 1") +def test_message_0x33(conn): + notices = [] + conn.add_notice_handler(lambda diag: notices.append(diag.message_primary)) + + conn.autocommit = True + with conn.pipeline(): + cur = conn.execute("select 'test'") + cur.fetchone() == ("test",) + + assert not notices + + def test_concurrency(conn): with conn.transaction(): conn.execute("drop table if exists pipeline_concurrency") diff --git a/tests/test_pipeline_async.py b/tests/test_pipeline_async.py index c170dfa23..ef929b3b1 100644 --- a/tests/test_pipeline_async.py +++ b/tests/test_pipeline_async.py @@ -489,6 +489,18 @@ async def test_rollback_transaction(aconn): await aconn.execute("select 1") +async def test_message_0x33(aconn): + notices = [] + aconn.add_notice_handler(lambda diag: notices.append(diag.message_primary)) + + await aconn.set_autocommit(True) + async with aconn.pipeline(): + cur = await aconn.execute("select 'test'") + await cur.fetchone() == ("test",) + + assert not notices + + async def test_concurrency(aconn): async with aconn.transaction(): await aconn.execute("drop table if exists pipeline_concurrency") -- 2.47.3