Parameterize workload

This commit is contained in:
Bojan Serafimov
2022-04-14 10:17:21 -04:00
parent 7fc488ff4b
commit 0b53968db4

View File

@@ -1,12 +1,25 @@
from contextlib import closing
import pytest
from fixtures.zenith_fixtures import ZenithEnv, PgBin, ZenithEnvBuilder, DEFAULT_BRANCH_NAME, PsbenchBin
from fixtures.benchmark_fixture import MetricReport, ZenithBenchmarker
@pytest.mark.slow
@pytest.mark.parametrize(
"workload",
[
"hot-page",
"pgbench",
"pgbench-big",
"pgbench-long",
])
def test_get_page(zenith_env_builder: ZenithEnvBuilder,
zenbenchmark: ZenithBenchmarker,
pg_bin: PgBin,
psbench_bin: PsbenchBin):
psbench_bin: PsbenchBin,
workload: str):
zenith_env_builder.pageserver_config_override = "emit_wal_metadata=true"
env = zenith_env_builder.init_start()
@@ -21,10 +34,7 @@ def test_get_page(zenith_env_builder: ZenithEnvBuilder,
with closing(pg.connect()) as conn:
with conn.cursor() as cur:
workload = "pgbench"
print(f"Running workload {workload}")
if workload == "hot page":
if workload == "hot-page":
cur.execute('create table t (i integer);')
cur.execute('insert into t values (0);')
for i in range(100000):
@@ -32,10 +42,10 @@ def test_get_page(zenith_env_builder: ZenithEnvBuilder,
elif workload == "pgbench":
pg_bin.run_capture(['pgbench', '-s5', '-i', pg.connstr()])
pg_bin.run_capture(['pgbench', '-c1', '-t5000', pg.connstr()])
elif workload == "pgbench big":
elif workload == "pgbench-big":
pg_bin.run_capture(['pgbench', '-s100', '-i', pg.connstr()])
pg_bin.run_capture(['pgbench', '-c1', '-t100000', pg.connstr()])
elif workload == "pgbench long":
elif workload == "pgbench-long":
pg_bin.run_capture(['pgbench', '-s100', '-i', pg.connstr()])
pg_bin.run_capture(['pgbench', '-c1', '-t1000000', pg.connstr()])