From bcaa59c0b9356e04bc4ae5bd08eb7a3752cb1dd0 Mon Sep 17 00:00:00 2001 From: Alexey Kondratov Date: Tue, 3 Aug 2021 18:06:05 +0300 Subject: [PATCH] Test compute restart with AND without safekeepers --- .../batch_others/test_restart_compute.py | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/test_runner/batch_others/test_restart_compute.py b/test_runner/batch_others/test_restart_compute.py index 464d3ed3d7..10d9929873 100644 --- a/test_runner/batch_others/test_restart_compute.py +++ b/test_runner/batch_others/test_restart_compute.py @@ -1,3 +1,5 @@ +import pytest + from contextlib import closing from fixtures.zenith_fixtures import ZenithPageserver, PostgresFactory @@ -7,10 +9,24 @@ pytest_plugins = ("fixtures.zenith_fixtures") # # Test restarting and recreating a postgres instance # -def test_restart_compute(zenith_cli, pageserver: ZenithPageserver, postgres: PostgresFactory, pg_bin): +@pytest.mark.parametrize('with_wal_acceptors', [False, True]) +def test_restart_compute( + zenith_cli, + pageserver: ZenithPageserver, + postgres: PostgresFactory, + pg_bin, + wa_factory, + with_wal_acceptors: bool, + ): + wal_acceptor_connstrs = None zenith_cli.run(["branch", "test_restart_compute", "empty"]) - pg = postgres.create_start('test_restart_compute') + if with_wal_acceptors: + wa_factory.start_n_new(3) + wal_acceptor_connstrs = wa_factory.get_connstrs() + + pg = postgres.create_start('test_restart_compute', + wal_acceptors=wal_acceptor_connstrs) print("postgres is running on 'test_restart_compute' branch") with closing(pg.connect()) as conn: @@ -20,7 +36,8 @@ def test_restart_compute(zenith_cli, pageserver: ZenithPageserver, postgres: Pos cur.execute("INSERT INTO foo VALUES ('bar')") # Stop and restart the Postgres instance - pg.stop_and_destroy().create_start('test_restart_compute') + pg.stop_and_destroy().create_start('test_restart_compute', + wal_acceptors=wal_acceptor_connstrs) with closing(pg.connect()) as conn: with conn.cursor() as cur: @@ -34,7 +51,8 @@ def test_restart_compute(zenith_cli, pageserver: ZenithPageserver, postgres: Pos assert cur.fetchone() == (2, ) # Stop, and destroy the Postgres instance. Then recreate and restart it. - pg.stop_and_destroy().create_start('test_restart_compute') + pg.stop_and_destroy().create_start('test_restart_compute', + wal_acceptors=wal_acceptor_connstrs) with closing(pg.connect()) as conn: with conn.cursor() as cur: