Some refactoring

This commit is contained in:
Alexey Masterov
2024-09-10 12:52:46 +02:00
parent fe8fee0b88
commit 841b39f7c5

View File

@@ -52,15 +52,17 @@ def setup(remote_pg: RemotePostgres):
"RETURNS int AS 'regress.so' LANGUAGE C STRICT STABLE PARALLEL SAFE;"
)
conn.rollback()
yield
log.info("Looking for extra roles...")
#cur.execute(
# "SELECT rolname FROM pg_catalog.pg_roles WHERE oid > 16384 AND rolname <> 'neondb_owner'"
#)
#log.info("Rows count: %s", cur.rowcount)
#for role in cur:
# cur.execute(f"DROP ROLE {role[0]}")
#conn.commit()
yield
log.info("Looking for extra roles...")
with psycopg2.connect(remote_pg.connstr()) as conn:
with conn.cursor() as cur:
cur.execute(
"SELECT rolname FROM pg_catalog.pg_roles WHERE oid > 16384 AND rolname <> 'neondb_owner'"
)
log.info("Rows count: %s", cur.rowcount)
for role in cur:
cur.execute(f"DROP ROLE {role[0]}")
conn.commit()
@pytest.mark.timeout(7200)