From 7a370394a7edebcade98fdc04319049cbbf88b49 Mon Sep 17 00:00:00 2001 From: Arseny Sher Date: Sun, 26 Sep 2021 22:59:21 +0300 Subject: [PATCH] Wait till previous victim recovers in run_restarts_under_load. Fixes test flakiness, as recovery easily might take the whole iteration. --- test_runner/batch_others/test_wal_acceptor_async.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test_runner/batch_others/test_wal_acceptor_async.py b/test_runner/batch_others/test_wal_acceptor_async.py index 4ee79fe85f..b1647a8544 100644 --- a/test_runner/batch_others/test_wal_acceptor_async.py +++ b/test_runner/batch_others/test_wal_acceptor_async.py @@ -1,6 +1,5 @@ import asyncio import asyncpg -import pytest import random from fixtures.zenith_fixtures import WalAcceptor, WalAcceptorFactory, ZenithPageserver, PostgresFactory, Postgres @@ -119,9 +118,14 @@ async def run_restarts_under_load(pg: Postgres, acceptors: List[WalAcceptor], n_ victim = acceptors[it % len(acceptors)] victim.stop() - # wait for transactions that could have started and finished before - # victim acceptor was stopped - await asyncio.sleep(1) + # Wait till previous victim recovers so it is ready for the next + # iteration by making any writing xact. + conn = await pg.connect_async() + await conn.execute( + 'UPDATE bank_accs SET amount = amount WHERE uid = 1', + timeout=120 + ) + await conn.close() stats.reset() await asyncio.sleep(period_time) @@ -140,7 +144,6 @@ async def run_restarts_under_load(pg: Postgres, acceptors: List[WalAcceptor], n_ # restart acceptors one by one, while executing and validating bank transactions -@pytest.mark.skip(reason="not stable enough") def test_restarts_under_load(zenith_cli, pageserver: ZenithPageserver, postgres: PostgresFactory, wa_factory: WalAcceptorFactory):