mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-15 17:32:56 +00:00
With the introduction of test-local tenants and timelines, we can still allow tests to share a pageserver and/or safekeeper, removing the overhead of setting up those components. Future work can add wrappers for Pageserver, Safekeepers, and other APIs that expose tenant-level configuration options that shouldn't impact concurrent or sequential tests that reuse the same PS/SK resources. Important note: This doesn't yet work consistently for all updated tests. [skip ci]
26 lines
808 B
Python
26 lines
808 B
Python
from fixtures.neon_fixtures import NeonEnv
|
|
from fixtures.shared_fixtures import TTimeline
|
|
from fixtures.utils import query_scalar
|
|
|
|
|
|
#
|
|
# Test CREATE USER to check shared catalog restore
|
|
#
|
|
def test_createuser(timeline: TTimeline):
|
|
endpoint = timeline.primary
|
|
|
|
with endpoint.cursor() as cur:
|
|
# Cause a 'relmapper' change in the original branch
|
|
cur.execute("CREATE USER testuser with password %s", ("testpwd",))
|
|
|
|
cur.execute("CHECKPOINT")
|
|
|
|
lsn = query_scalar(cur, "SELECT pg_current_wal_insert_lsn()")
|
|
|
|
# Create a branch
|
|
branch = timeline.create_branch("test_createuser2", lsn=lsn)
|
|
endpoint2 = branch.primary
|
|
|
|
# Test that you can connect to new branch as a new user
|
|
assert endpoint2.safe_psql("select current_user", user="testuser") == [("testuser",)]
|