From 67d2fa6dec41af962655198b13f9f8f3a7dc6ef4 Mon Sep 17 00:00:00 2001 From: Joonas Koivunen Date: Thu, 27 Jul 2023 19:13:58 +0300 Subject: [PATCH] test: fix `test_neon_cli_basics` flakyness without making it better for future (#4827) The test was starting two endpoints on the same branch as discovered by @petuhovskiy. The fix is to allow passing branch-name from the python side over to neon_local, which already accepted it. Split from #4824, which will handle making this more misuse resistant. --- test_runner/fixtures/neon_fixtures.py | 4 ++++ test_runner/regress/test_neon_local_cli.py | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test_runner/fixtures/neon_fixtures.py b/test_runner/fixtures/neon_fixtures.py index eafc061ab9..5e4553f52d 100644 --- a/test_runner/fixtures/neon_fixtures.py +++ b/test_runner/fixtures/neon_fixtures.py @@ -1504,6 +1504,7 @@ class NeonCli(AbstractNeonCli): safekeepers: Optional[List[int]] = None, tenant_id: Optional[TenantId] = None, lsn: Optional[Lsn] = None, + branch_name: Optional[str] = None, ) -> "subprocess.CompletedProcess[str]": args = [ "endpoint", @@ -1517,8 +1518,11 @@ class NeonCli(AbstractNeonCli): args.append(f"--lsn={lsn}") args.extend(["--pg-port", str(pg_port)]) args.extend(["--http-port", str(http_port)]) + if safekeepers is not None: args.extend(["--safekeepers", (",".join(map(str, safekeepers)))]) + if branch_name is not None: + args.extend(["--branch-name", branch_name]) if endpoint_id is not None: args.append(endpoint_id) diff --git a/test_runner/regress/test_neon_local_cli.py b/test_runner/regress/test_neon_local_cli.py index 3314e7fbf6..6dd47de8cf 100644 --- a/test_runner/regress/test_neon_local_cli.py +++ b/test_runner/regress/test_neon_local_cli.py @@ -16,11 +16,13 @@ def test_neon_cli_basics(neon_env_builder: NeonEnvBuilder, port_distributor: Por endpoint_id="ep-basic-main", pg_port=pg_port, http_port=http_port ) - env.neon_cli.create_branch(new_branch_name="migration_check") + branch_name = "migration-check" + + env.neon_cli.create_branch(new_branch_name=branch_name) pg_port = port_distributor.get_port() http_port = port_distributor.get_port() env.neon_cli.endpoint_start( - endpoint_id="ep-migration_check", pg_port=pg_port, http_port=http_port + f"ep-{branch_name}", pg_port, http_port, branch_name=branch_name ) finally: env.neon_cli.stop()