diff --git a/test_runner/fixtures/neon_fixtures.py b/test_runner/fixtures/neon_fixtures.py index c4705168b7..b7c192bb8d 100644 --- a/test_runner/fixtures/neon_fixtures.py +++ b/test_runner/fixtures/neon_fixtures.py @@ -1773,6 +1773,16 @@ class NeonPageserver(PgProtocol): client = self.http_client() return client.tenant_attach(tenant_id, config, config_null, generation=generation) + def tenant_location_configure(self, tenant_id: TenantId, config: dict[str, Any]): + # This API is only for use when generations are enabled + assert self.env.attachment_service is not None + + if config["mode"].startswith("Attached") and "generation" not in config: + config["generation"] = self.env.attachment_service.attach_hook(tenant_id, self.id) + + client = self.http_client() + return client.tenant_location_conf(tenant_id, config) + def append_pageserver_param_overrides( params_to_update: List[str], diff --git a/test_runner/fixtures/pageserver/http.py b/test_runner/fixtures/pageserver/http.py index d2c3715c52..49e2aeb5ed 100644 --- a/test_runner/fixtures/pageserver/http.py +++ b/test_runner/fixtures/pageserver/http.py @@ -247,6 +247,14 @@ class PageserverHttpClient(requests.Session): res = self.post(f"http://localhost:{self.port}/v1/tenant/{tenant_id}/detach", params=params) self.verbose_error(res) + def tenant_location_conf(self, tenant_id: TenantId, location_conf=dict[str, Any]): + body = location_conf.copy() + body["tenant_id"] = str(tenant_id) + res = self.put( + f"http://localhost:{self.port}/v1/tenant/{tenant_id}/location_config", json=body + ) + self.verbose_error(res) + def tenant_delete(self, tenant_id: TenantId): res = self.delete(f"http://localhost:{self.port}/v1/tenant/{tenant_id}") self.verbose_error(res)