Fix creating publications for all tables

This commit is contained in:
Sasha Krassovsky
2024-01-24 02:29:08 +00:00
committed by Sasha Krassovsky
parent 743f6dfb9b
commit 4f51824820
5 changed files with 40 additions and 6 deletions

View File

@@ -0,0 +1,34 @@
import time
from fixtures.neon_fixtures import NeonEnv
from fixtures.pg_version import PgVersion
def test_neon_superuser(neon_simple_env: NeonEnv, pg_version: PgVersion):
env = neon_simple_env
env.neon_cli.create_branch("test_neon_superuser", "empty")
endpoint = env.endpoints.create("test_neon_superuser")
endpoint.respec(skip_pg_catalog_updates=False, features=["migrations"])
endpoint.start()
time.sleep(1) # Sleep to let migrations run
with endpoint.cursor() as cur:
cur.execute(
"CREATE ROLE mr_whiskers WITH PASSWORD 'cat' LOGIN INHERIT CREATEROLE CREATEDB BYPASSRLS REPLICATION IN ROLE neon_superuser"
)
cur.execute("CREATE DATABASE neondb WITH OWNER mr_whiskers")
cur.execute("GRANT ALL PRIVILEGES ON DATABASE neondb TO neon_superuser")
with endpoint.cursor(dbname="neondb", user="mr_whiskers", password="cat") as cur:
cur.execute("SELECT pg_has_role('mr_whiskers', 'neon_superuser', 'member')")
assert cur.fetchall()[0][0]
cur.execute("SELECT pg_has_role('mr_whiskers', 'neon_superuser', 'usage')")
assert cur.fetchall()[0][0]
if pg_version == PgVersion.V16:
cur.execute("SELECT pg_has_role('mr_whiskers', 'neon_superuser', 'set')")
assert cur.fetchall()[0][0]
cur.execute("CREATE PUBLICATION pub FOR ALL TABLES")
cur.execute("CREATE ROLE definitely_not_a_superuser WITH PASSWORD 'nope'")

View File

@@ -1,5 +1,5 @@
{
"postgres-v16": "7be4a52d728459b79b59343c57d338c3073059c8",
"postgres-v15": "c1c2272f436ed9231f6172f49de219fe71a9280d",
"postgres-v14": "82072911287cabb32018cf92c8425fa1c744def4"
"postgres-v16": "cf302768b2890569956641e0e5ba112ae1445351",
"postgres-v15": "731b4d1609d6db1c953755810a41e0e67ea3db7b",
"postgres-v14": "11e970fe2be56804f0a786ec5fc8141ffefa4ca7"
}