From 70a53c4b0316e3f35cf9f558590984db7895beba Mon Sep 17 00:00:00 2001 From: Arseny Sher Date: Fri, 3 Jun 2022 14:10:34 +0400 Subject: [PATCH] Get backup test_safekeeper_normal_work, but skip by default. It is handy for development. --- test_runner/batch_others/test_wal_acceptor.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test_runner/batch_others/test_wal_acceptor.py b/test_runner/batch_others/test_wal_acceptor.py index 1932c3e450..3c74c729a1 100644 --- a/test_runner/batch_others/test_wal_acceptor.py +++ b/test_runner/batch_others/test_wal_acceptor.py @@ -18,6 +18,26 @@ from fixtures.log_helper import log from typing import List, Optional, Any +# basic test, write something in setup with 3 wal acceptors, ensure that commits +# succeed and data is written +@pytest.mark.skip(reason="simple test for development") +def test_safekeeper_normal_work(neon_env_builder: NeonEnvBuilder): + neon_env_builder.num_safekeepers = 3 + env = neon_env_builder.init_start() + + env.neon_cli.create_branch('test_safekeepers_normal_work') + pg = env.postgres.create_start('test_safekeepers_normal_work') + + with closing(pg.connect()) as conn: + with conn.cursor() as cur: + # we rely upon autocommit after each statement + # as waiting for acceptors happens there + cur.execute('CREATE TABLE t(key int primary key, value text)') + cur.execute("INSERT INTO t SELECT generate_series(1,100000), 'payload'") + cur.execute('SELECT sum(key) FROM t') + assert cur.fetchone() == (5000050000, ) + + @dataclass class TimelineMetrics: timeline_id: str