mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 21:42:56 +00:00
* Add --id argument to safekeeper setting its unique u64 id. In preparation for storage node messaging. IDs are supposed to be monotonically assigned by the console. In tests it is issued by ZenithEnv; at the zenith cli level and fixtures, string name is completely replaced by integer id. Example TOML configs are adjusted accordingly. Sequential ids are chosen over Zid mainly because they are compact and easy to type/remember. * add node id to pageserver This adds node id parameter to pageserver configuration. Also I use a simple builder to construct pageserver config struct to avoid setting node id to some temporary invalid value. Some of the changes in test fixtures are needed to split init and start operations for envrionment. Co-authored-by: Arseny Sher <sher-ars@yandex.ru>
45 lines
1.8 KiB
Python
45 lines
1.8 KiB
Python
from contextlib import closing
|
|
|
|
import pytest
|
|
|
|
from fixtures.zenith_fixtures import ZenithEnvBuilder
|
|
|
|
|
|
@pytest.mark.parametrize('with_wal_acceptors', [False, True])
|
|
def test_tenants_normal_work(zenith_env_builder: ZenithEnvBuilder, with_wal_acceptors: bool):
|
|
if with_wal_acceptors:
|
|
zenith_env_builder.num_safekeepers = 3
|
|
|
|
env = zenith_env_builder.init_start()
|
|
"""Tests tenants with and without wal acceptors"""
|
|
tenant_1 = env.create_tenant()
|
|
tenant_2 = env.create_tenant()
|
|
|
|
env.zenith_cli.create_branch(f"test_tenants_normal_work_with_wal_acceptors{with_wal_acceptors}",
|
|
"main",
|
|
tenant_id=tenant_1)
|
|
env.zenith_cli.create_branch(f"test_tenants_normal_work_with_wal_acceptors{with_wal_acceptors}",
|
|
"main",
|
|
tenant_id=tenant_2)
|
|
|
|
pg_tenant1 = env.postgres.create_start(
|
|
f"test_tenants_normal_work_with_wal_acceptors{with_wal_acceptors}",
|
|
None, # branch name, None means same as node name
|
|
tenant_1,
|
|
)
|
|
pg_tenant2 = env.postgres.create_start(
|
|
f"test_tenants_normal_work_with_wal_acceptors{with_wal_acceptors}",
|
|
None, # branch name, None means same as node name
|
|
tenant_2,
|
|
)
|
|
|
|
for pg in [pg_tenant1, pg_tenant2]:
|
|
with closing(pg.connect()) as conn:
|
|
with conn.cursor() as cur:
|
|
# we rely upon autocommit after each statement
|
|
# as waiting for acceptors happens there
|
|
cur.execute("CREATE TABLE t(key int primary key, value text)")
|
|
cur.execute("INSERT INTO t SELECT generate_series(1,100000), 'payload'")
|
|
cur.execute("SELECT sum(key) FROM t")
|
|
assert cur.fetchone() == (5000050000, )
|