]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Run tests against CockroachDB v22.2
authorRafi Shamim <rafi@cockroachlabs.com>
Mon, 12 Dec 2022 21:47:33 +0000 (16:47 -0500)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 16 Dec 2022 03:33:37 +0000 (03:33 +0000)
v22.2 was released recently, so we can test it. This upgrade revealed a
regression in CRDB that we must workaround
(https://github.com/cockroachdb/cockroach/issues/93739).

This also removes testing for v21.2, since it is no longer supported.

.github/workflows/tests.yml
tests/crdb/test_connection.py
tests/crdb/test_connection_async.py

index 0fdd99be26a59ff3c339e8495409559412168ddf..160a71b08558d08b82ad20974edc35d3edcfd691 100644 (file)
@@ -265,8 +265,8 @@ jobs:
       fail-fast: false
       matrix:
         include:
+          - {crdb: "latest-v22.2", python: "3.10", impl: "c", libpq: "newest"}
           - {crdb: "latest-v22.1", python: "3.10", impl: "c", libpq: "newest"}
-          - {crdb: "latest-v21.2", python: "3.9", impl: "python", libpq: ""}
 
     env:
       PSYCOPG_IMPL: ${{ matrix.impl }}
index e3d4b46731da67e4676e036ce8a1d1fed8b0096d..b2a69ef5307de1c7ff9634d604ccc9a851efbfd5 100644 (file)
@@ -44,8 +44,9 @@ def test_tpc_recover(dsn):
 @pytest.mark.slow
 def test_broken_connection(conn):
     cur = conn.cursor()
+    (session_id,) = cur.execute("select session_id from [show session_id]").fetchone()
     with pytest.raises(psycopg.DatabaseError):
-        cur.execute("cancel session (select session_id from [show session_id])")
+        cur.execute("cancel session %s", [session_id])
     assert conn.closed
 
 
index 6fb8fdfe865c78cdeba3f5fe82f71a4be6b41809..b568e426e3c187121eece2054fa463e1bd28dc1f 100644 (file)
@@ -42,8 +42,10 @@ async def test_tpc_recover(dsn):
 @pytest.mark.slow
 async def test_broken_connection(aconn):
     cur = aconn.cursor()
+    await cur.execute("select session_id from [show session_id]")
+    (session_id,) = await cur.fetchone()
     with pytest.raises(psycopg.DatabaseError):
-        await cur.execute("cancel session (select session_id from [show session_id])")
+        await cur.execute("cancel session %s", [session_id])
     assert aconn.closed