Add (longer) retry in concurrent test db setup/teardown
@@ -955,14 +955,23 @@ class DatabaseTestCase(ClusterTestCase, ConnectedTestCaseMixin):
)
base_db_name, _, _ = dbname.rpartition('_')
- cls.loop.run_until_complete(
- cls.admin_conn.execute(
+
+ # The retry here allows the test to survive a concurrent testing
+ # EdgeDB server (e.g. async with tb.start_edgedb_server()) whose
+ # introspection holds a lock on the base_db here
+ async def create_db():
+ async for tr in cls.try_until_succeeds(
+ ignore=edgedb.ExecutionError,
+ timeout=30,
+ ):
+ async with tr:
+ await cls.admin_conn.execute(
f'''
CREATE DATABASE {qlquote.quote_ident(dbname)}
FROM {qlquote.quote_ident(base_db_name)}
''',
- ),
)
+ cls.loop.run_until_complete(create_db())
if not orig_testmode:
cls.loop.run_until_complete(
@@ -1013,7 +1022,7 @@ class DatabaseTestCase(ClusterTestCase, ConnectedTestCaseMixin):
async def drop_db():
async for tr in cls.try_until_succeeds(
ignore=edgedb.ExecutionError,
- timeout=5
+ timeout=30
):
async with tr:
await cls.admin_conn.execute(
