mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-16 18:02:56 +00:00
## Problem We currently can't create subscriptions in PG14 and PG15 because only superusers can, and PG16 requires adding roles to pg_create_subscription. ## Summary of changes I added changes to PG14 and PG15 that allow neon_superuser to bypass the superuser requirement. For PG16, I didn't do that but added a migration that adds neon_superuser to pg_create_subscription. Also added a test to make sure it works.
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
import time
|
|
|
|
from fixtures.neon_fixtures import NeonEnv
|
|
|
|
|
|
def test_migrations(neon_simple_env: NeonEnv):
|
|
env = neon_simple_env
|
|
env.neon_cli.create_branch("test_migrations", "empty")
|
|
|
|
endpoint = env.endpoints.create("test_migrations")
|
|
log_path = endpoint.endpoint_path() / "compute.log"
|
|
|
|
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("SELECT id FROM neon_migration.migration_id")
|
|
migration_id = cur.fetchall()
|
|
assert migration_id[0][0] == 3
|
|
|
|
with open(log_path, "r") as log_file:
|
|
logs = log_file.read()
|
|
assert "INFO handle_migrations: Ran 3 migrations" in logs
|
|
|
|
endpoint.stop()
|
|
endpoint.start()
|
|
time.sleep(1) # Sleep to let migrations run
|
|
with endpoint.cursor() as cur:
|
|
cur.execute("SELECT id FROM neon_migration.migration_id")
|
|
migration_id = cur.fetchall()
|
|
assert migration_id[0][0] == 3
|
|
|
|
with open(log_path, "r") as log_file:
|
|
logs = log_file.read()
|
|
assert "INFO handle_migrations: Ran 0 migrations" in logs
|