mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-14 08:52:56 +00:00
This patch makes the creation of the initial tenant & timeline optional. The motivation was https://github.com/neondatabase/neon/pull/3905#discussion_r1153627388 However, most existing tests require the env.initial_tenant. We don't want to change all of these here. So, the apporach taken here is to make NeonEnv a subclass of NeonEnvWithoutInitialTenant. It's not a proper subclass, but more of wrapper type. Hence the __new__ hackery. I guess this is a bad substitute for a Rust newtype + Deref impl. The initial tenant & timeline are created in NeonEnv, and the tenant is set as default (`--set-default`). We rely more on that default than before. Specifically, all neon_local invocation that previously used "--tenant-id", (tenant_id if tenant_id is not None else env.initial_tenant) now do *(["--tenant-id", tenant_id] if tenant_id is not None else []) The only real trouble with that was `Postgres` class's `pgdata_dir` member. I solved this by making `neon_local pg create` return the PGDATA dir path, instead of pre-computing it in Python. A net win, I think.