From 7660db875fd1df220359cb4d3cf8891fb830afda Mon Sep 17 00:00:00 2001 From: Fantix King Date: Thu, 19 Sep 2024 14:03:53 -0400 Subject: [PATCH] Retry DROP DATABASE for tests This partially reverts commit 3285fcbb5090ed2ee5573edbc88a7a6b1766b5f2. --- edb/testbase/server.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/edb/testbase/server.py b/edb/testbase/server.py index 3e40b5a4bf1..eb8b5697e50 100644 --- a/edb/testbase/server.py +++ b/edb/testbase/server.py @@ -764,7 +764,18 @@ def _extract_background_errors(metrics: str) -> str | None: async def drop_db(conn, dbname): - await conn.execute(f'DROP DATABASE {dbname}') + # net_worker (#7742) may issue a query while DROP DATABASE happens. + # This is a WIP bug that should be solved when adopting notification- + # driven net_worker, but hack around it with a retry loop for now. + # Without this, tests would flake a lot. + async for tr in TestCase.try_until_succeeds( + ignore=(edgedb.ExecutionError, edgedb.ClientConnectionError), + timeout=30 + ): + async with tr: + await conn.execute( + f'DROP DATABASE {dbname};' + ) class ClusterTestCase(BaseHTTPTestCase):