Skip to content

Commit

Permalink
Fix test to be more robust with slow pageserver.
Browse files Browse the repository at this point in the history
If the WAL arrives at the pageserver slowly, it's possible that the
branch is created before all the data on the parent branch have
arrived. That results in a failure:

    test_runner/batch_others/test_tenant_relocation.py:259: in test_tenant_relocation
        timeline_id_second, current_lsn_second = populate_branch(pg_second, create_table=False, expected_sum=1001000)
    test_runner/batch_others/test_tenant_relocation.py:133: in populate_branch
        assert cur.fetchone() == (expected_sum, )
    E   assert (500500,) == (1001000,)
    E     At index 0 diff: 500500 != 1001000
    E     Full diff:
    E     - (1001000,)
    E     + (500500,)

To fix, specify the LSN to branch at, so that the pageserver will wait
for it arrive.

See #2063
  • Loading branch information
hlinnaka committed Jul 20, 2022
1 parent 160e52e commit abff15d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test_runner/batch_others/test_tenant_relocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
wait_for_upload,
wait_until,
)
from fixtures.utils import lsn_from_hex, subprocess_capture
from fixtures.utils import lsn_from_hex, lsn_to_hex, subprocess_capture


def assert_abs_margin_ratio(a: float, b: float, margin_ratio: float):
Expand Down Expand Up @@ -268,6 +268,7 @@ def test_tenant_relocation(neon_env_builder: NeonEnvBuilder,
env.neon_cli.create_branch(
new_branch_name="test_tenant_relocation_second",
ancestor_branch_name="test_tenant_relocation_main",
ancestor_start_lsn=lsn_to_hex(current_lsn_main),
tenant_id=tenant_id,
)
pg_second = env.postgres.create_start(branch_name='test_tenant_relocation_second',
Expand Down

0 comments on commit abff15d

Please sign in to comment.