Skip to content

Commit 86c594d

Browse files
Extended runner functional coverage (#138)
1 parent c1d5809 commit 86c594d

File tree

5 files changed

+117
-5
lines changed

5 files changed

+117
-5
lines changed

redis_benchmarks_specification/__runner__/runner.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ def main():
6565
)
6666
args = parser.parse_args()
6767

68+
run_client_runner_logic(args, project_name, project_name_suffix, project_version)
69+
70+
71+
def run_client_runner_logic(args, project_name, project_name_suffix, project_version):
6872
if args.logname is not None:
6973
print("Writting log to {}".format(args.logname))
7074
logging.basicConfig(
@@ -83,7 +87,6 @@ def main():
8387
)
8488
logging.info(get_version_string(project_name, project_version))
8589
testsuite_spec_files = extract_testsuites(args)
86-
8790
datasink_conn = None
8891
if args.datasink_push_results_redistimeseries:
8992
logging.info(
@@ -113,7 +116,6 @@ def main():
113116
)
114117
logging.error("Error message {}".format(e.__str__()))
115118
exit(1)
116-
117119
running_platform = args.platform_name
118120
tls_enabled = args.tls
119121
tls_skip_verify = args.tls_skip_verify
@@ -124,7 +126,6 @@ def main():
124126
preserve_temporary_client_dirs = args.preserve_temporary_client_dirs
125127
docker_client = docker.from_env()
126128
home = str(Path.home())
127-
128129
profilers_list = []
129130
profilers_enabled = args.enable_profilers
130131
if profilers_enabled:
@@ -137,9 +138,7 @@ def main():
137138
)
138139
)
139140
exit(1)
140-
141141
logging.info("Running the benchmark specs.")
142-
143142
process_self_contained_coordinator_stream(
144143
args,
145144
args.datasink_push_results_redistimeseries,

tox.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,17 @@ commands =
2020

2121
docker =
2222
datasink
23+
db_server
2324

2425
[docker:datasink]
2526
image = redis/redis-stack-server:7.0.2-RC4
2627
ports =
2728
16379:6379/tcp
2829
volumes =
2930
bind:rw:{toxinidir}/utils/tests/test_data/:/data
31+
32+
33+
[docker:db_server]
34+
image = redis/redis-stack-server:7.0.2-RC4
35+
ports =
36+
6380:6379/tcp

utils/tests/test_data/dump.rdb

0 Bytes
Binary file not shown.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: 0.4
2+
name: "memtier_benchmark-10keys-100B-expire-use-case"
3+
description: "Runs memtier_benchmark, for a keyspace length of 1M keys
4+
with a data size of 100 Bytes for each key, which 50% of the keys have expiration set during the benchmark."
5+
dbconfig:
6+
configuration-parameters:
7+
save: '""'
8+
preload_tool:
9+
run_image: redislabs/memtier_benchmark:edge
10+
tool: memtier_benchmark
11+
arguments: '"--command" "SETEX __key__ 360 __value__" "--command-key-pattern" "P" "-c" "5" "-t" "2" "--hide-histogram" "--key-minimum" 1 "--key-maximum" "10"'
12+
tested-commands:
13+
- SET
14+
- SETX
15+
- GET
16+
redis-topologies:
17+
- oss-standalone
18+
build-variants:
19+
- abc
20+
clientconfig:
21+
run_image: redislabs/memtier_benchmark:edge
22+
tool: memtier_benchmark
23+
arguments: '"--key-minimum" 1 "--key-maximum" "10" --command "SETEX __key__ 10 __value__" --command-key-pattern="R" --command "SET __key__ __value__" --command-key-pattern="R" --command "GET __key__" --command-key-pattern="R" -c 5 -t 1 --hide-histogram --test-time 10'
24+
resources:
25+
requests:
26+
cpus: "1"
27+
memory: "2g"
28+
exporter:
29+
redistimeseries:
30+
break_by:
31+
- version
32+
- commit
33+
timemetric: '$."ALL STATS".Runtime."Start time"'
34+
metrics:
35+
- '$."ALL STATS".Totals."Ops/sec"'
36+
- '$."ALL STATS".Totals."Latency"'
37+
- '$."ALL STATS".Totals."Misses/sec"'
38+
- '$."ALL STATS".Totals."Percentile Latencies"."p50.00"'

utils/tests/test_runner.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
import argparse
2+
3+
import redis
14
import yaml
25

6+
from redis_benchmarks_specification.__common__.package import get_version_string
37
from redis_benchmarks_specification.__common__.spec import extract_client_tool
8+
from redis_benchmarks_specification.__runner__.args import create_client_runner_args
49
from redis_benchmarks_specification.__runner__.runner import (
510
prepare_memtier_benchmark_parameters,
11+
run_client_runner_logic,
612
)
713

814

@@ -140,3 +146,65 @@ def test_prepare_memtier_benchmark_parameters():
140146
benchmark_command_str
141147
== 'memtier_benchmark --port 12000 --server localhost --json-out-file 1.json --tls --cert cert.file --key key.file --cacert cacert.file "--data-size" "100" --command "SETEX __key__ 10 __value__" --command-key-pattern="R" --command "SET __key__ __value__" --command-key-pattern="R" --command "GET __key__" --command-key-pattern="R" --command "DEL __key__" --command-key-pattern="R" -c 50 -t 2 --hide-histogram --test-time 300'
142148
)
149+
150+
151+
def test_run_client_runner_logic():
152+
project_name = "tool"
153+
project_version = "v0"
154+
parser = argparse.ArgumentParser(
155+
description="test",
156+
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
157+
)
158+
parser = create_client_runner_args(
159+
get_version_string(project_name, project_version)
160+
)
161+
db_host = "localhost"
162+
db_port = "6380"
163+
datasink_port = "16379"
164+
db_port_int = int(db_port)
165+
datasink_port_int = int(db_port)
166+
args = parser.parse_args(
167+
args=[
168+
"--test",
169+
"../../utils/tests/test_data/test-suites/memtier_benchmark-10keys-100B-expire-use-case-with-variant.yml",
170+
"--db_server_host",
171+
"{}".format(db_host),
172+
"--db_server_port",
173+
"{}".format(db_port),
174+
"--flushall_on_every_test_start",
175+
]
176+
)
177+
try:
178+
run_client_runner_logic(args, "tool", "", "v0")
179+
except SystemExit as e:
180+
assert e.code == 0
181+
182+
r = redis.Redis(host=db_host, port=db_port_int)
183+
total_keys = r.info("keyspace")["db0"]["keys"]
184+
assert total_keys == 10
185+
186+
# run while pushing to redistimeseries
187+
args = parser.parse_args(
188+
args=[
189+
"--test",
190+
"../../utils/tests/test_data/test-suites/memtier_benchmark-10keys-100B-expire-use-case-with-variant.yml",
191+
"--datasink_push_results_redistimeseries",
192+
"--datasink_redistimeseries_host",
193+
"{}".format(db_host),
194+
"--datasink_redistimeseries_port",
195+
"{}".format(datasink_port),
196+
"--db_server_host",
197+
"{}".format(db_host),
198+
"--db_server_port",
199+
"{}".format(db_port),
200+
"--flushall_on_every_test_start",
201+
]
202+
)
203+
try:
204+
run_client_runner_logic(args, "tool", "", "v0")
205+
except SystemExit as e:
206+
assert e.code == 0
207+
208+
r = redis.Redis(host=db_host, port=db_port_int)
209+
total_keys = r.info("keyspace")["db0"]["keys"]
210+
assert total_keys == 10

0 commit comments

Comments
 (0)