mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-06 13:02:55 +00:00
fix(test suite): forward compat test is not using latest neon_local (#7637)
The `test_forward_compatibility` test runs the old production binaries,
but is supposed to always run the latest neon_local binary.
I think commit 6acbee23 broke that by accident because in that commit,
`from_repo_dir` is introduced and runs an `init_start()` before the
`test_forward_compatibility` gets a chance to patch up the
neon_local_binpath.
This commit is contained in:
committed by
GitHub
parent
2dbd1c1ed5
commit
ea531d448e
@@ -488,6 +488,7 @@ class NeonEnvBuilder:
|
|||||||
self.env: Optional[NeonEnv] = None
|
self.env: Optional[NeonEnv] = None
|
||||||
self.keep_remote_storage_contents: bool = True
|
self.keep_remote_storage_contents: bool = True
|
||||||
self.neon_binpath = neon_binpath
|
self.neon_binpath = neon_binpath
|
||||||
|
self.neon_local_binpath = neon_binpath
|
||||||
self.pg_distrib_dir = pg_distrib_dir
|
self.pg_distrib_dir = pg_distrib_dir
|
||||||
self.pg_version = pg_version
|
self.pg_version = pg_version
|
||||||
self.preserve_database_files = preserve_database_files
|
self.preserve_database_files = preserve_database_files
|
||||||
@@ -632,17 +633,11 @@ class NeonEnvBuilder:
|
|||||||
def from_repo_dir(
|
def from_repo_dir(
|
||||||
self,
|
self,
|
||||||
repo_dir: Path,
|
repo_dir: Path,
|
||||||
neon_binpath: Optional[Path] = None,
|
|
||||||
pg_distrib_dir: Optional[Path] = None,
|
|
||||||
) -> NeonEnv:
|
) -> NeonEnv:
|
||||||
"""
|
"""
|
||||||
A simple method to import data into the current NeonEnvBuilder from a snapshot of a repo dir.
|
A simple method to import data into the current NeonEnvBuilder from a snapshot of a repo dir.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Setting custom `neon_binpath` and `pg_distrib_dir` is useful for compatibility tests
|
|
||||||
self.neon_binpath = neon_binpath or self.neon_binpath
|
|
||||||
self.pg_distrib_dir = pg_distrib_dir or self.pg_distrib_dir
|
|
||||||
|
|
||||||
# Get the initial tenant and timeline from the snapshot config
|
# Get the initial tenant and timeline from the snapshot config
|
||||||
snapshot_config_toml = repo_dir / "config"
|
snapshot_config_toml = repo_dir / "config"
|
||||||
with snapshot_config_toml.open("r") as f:
|
with snapshot_config_toml.open("r") as f:
|
||||||
@@ -1017,9 +1012,10 @@ class NeonEnv:
|
|||||||
self.pg_version = config.pg_version
|
self.pg_version = config.pg_version
|
||||||
# Binary path for pageserver, safekeeper, etc
|
# Binary path for pageserver, safekeeper, etc
|
||||||
self.neon_binpath = config.neon_binpath
|
self.neon_binpath = config.neon_binpath
|
||||||
# Binary path for neon_local test-specific binaries: may be overridden
|
# Binary path for neon_local test-specific binaries
|
||||||
# after construction for compat testing
|
self.neon_local_binpath = config.neon_local_binpath
|
||||||
self.neon_local_binpath = config.neon_binpath
|
if self.neon_local_binpath is None:
|
||||||
|
self.neon_local_binpath = self.neon_binpath
|
||||||
self.pg_distrib_dir = config.pg_distrib_dir
|
self.pg_distrib_dir = config.pg_distrib_dir
|
||||||
self.endpoint_counter = 0
|
self.endpoint_counter = 0
|
||||||
self.storage_controller_config = config.storage_controller_config
|
self.storage_controller_config = config.storage_controller_config
|
||||||
|
|||||||
@@ -233,17 +233,18 @@ def test_forward_compatibility(
|
|||||||
neon_env_builder.pageserver_validate_vectored_get = None
|
neon_env_builder.pageserver_validate_vectored_get = None
|
||||||
|
|
||||||
neon_env_builder.num_safekeepers = 3
|
neon_env_builder.num_safekeepers = 3
|
||||||
neon_local_binpath = neon_env_builder.neon_binpath
|
|
||||||
|
# Use previous version's production binaries (pageserver, safekeeper, pg_distrib_dir, etc.).
|
||||||
|
# But always use the current version's neon_local binary.
|
||||||
|
# This is because we want to test the compatibility of the data format, not the compatibility of the neon_local CLI.
|
||||||
|
neon_env_builder.neon_binpath = compatibility_neon_bin
|
||||||
|
neon_env_builder.pg_distrib_dir = compatibility_postgres_distrib_dir
|
||||||
|
neon_env_builder.neon_local_binpath = neon_env_builder.neon_local_binpath
|
||||||
|
|
||||||
env = neon_env_builder.from_repo_dir(
|
env = neon_env_builder.from_repo_dir(
|
||||||
compatibility_snapshot_dir / "repo",
|
compatibility_snapshot_dir / "repo",
|
||||||
neon_binpath=compatibility_neon_bin,
|
|
||||||
pg_distrib_dir=compatibility_postgres_distrib_dir,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Use current neon_local even though we're using old binaries for
|
|
||||||
# everything else: our test code is written for latest CLI args.
|
|
||||||
env.neon_local_binpath = neon_local_binpath
|
|
||||||
|
|
||||||
neon_env_builder.start()
|
neon_env_builder.start()
|
||||||
|
|
||||||
check_neon_works(
|
check_neon_works(
|
||||||
|
|||||||
Reference in New Issue
Block a user