diff --git a/test_runner/batch_others/test_tenant_conf.py b/test_runner/batch_others/test_tenant_conf.py new file mode 100644 index 0000000000..02d1e14da1 --- /dev/null +++ b/test_runner/batch_others/test_tenant_conf.py @@ -0,0 +1,21 @@ +from contextlib import closing + +import pytest + +from fixtures.zenith_fixtures import ZenithEnvBuilder + +def test_tenants_normal_work(zenith_env_builder: ZenithEnvBuilder): + env = zenith_env_builder.init() + """Test per tenant configuration""" + tenant = env.create_tenant(conf={'gc_period':'100sec','gc_horizon':'1024','pitr_interval':'3600sec','checkpoint_distance':'10000','checkpoint_period':'60sec'}) + + pg = env.postgres.create_start( + "test_tenant_conf", + "main", + tenant, + ) + + with closing(env.pageserver.connect()) as psconn: + with psconn.cursor() as pscur: + pscur.execute(f"show {tenant.hex}") + assert pscur.fetchone() == (10000, 60, 1024, 100, 3600) diff --git a/test_runner/fixtures/zenith_fixtures.py b/test_runner/fixtures/zenith_fixtures.py index a95809687a..09164bd4d0 100644 --- a/test_runner/fixtures/zenith_fixtures.py +++ b/test_runner/fixtures/zenith_fixtures.py @@ -853,13 +853,16 @@ class ZenithCli: self.env = env pass - def create_tenant(self, tenant_id: Optional[uuid.UUID] = None) -> uuid.UUID: + def create_tenant(self, tenant_id: Optional[uuid.UUID] = None, conf: Optional[Dict[str,str]] = None) -> uuid.UUID: """ Creates a new tenant, returns its id and its initial timeline's id. """ if tenant_id is None: tenant_id = uuid.uuid4() - res = self.raw_cli(['tenant', 'create', '--tenant-id', tenant_id.hex]) + if conf is None: + res = self.raw_cli(['tenant', 'create', '--tenant-id', tenant_id.hex]) + else: + res = self.raw_cli(['tenant', 'create', '--tenant-id', tenant_id.hex] + sum(list(map(lambda kv: (['-c', kv[0] + ':' + kv[1]]), conf.items())), [])) res.check_returncode() return tenant_id