Skip to content

Commit 08cab1e

Browse files
[add] Increased coverage of tool (#68)
1 parent 144e049 commit 08cab1e

File tree

5 files changed

+41
-4
lines changed

5 files changed

+41
-4
lines changed

redisbench_admin/run/common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,14 @@ def prepare_benchmark_parameters(benchmark_config, benchmark_tool, server_plaint
5959
if 'redisgraph-benchmark-go' in benchmark_tool:
6060
if isremote is True:
6161
benchmark_tool = "/tmp/redisgraph-benchmark-go"
62-
command_arr = prepareRedisGraphBenchmarkGoCommand(
62+
command_arr, command_str = prepareRedisGraphBenchmarkGoCommand(
6363
benchmark_tool,
6464
server_private_ip,
6565
server_plaintext_port,
6666
entry,
6767
remote_results_file,
6868
isremote
6969
)
70-
command_str = " ".join(command_arr)
7170

7271
if 'ycsb' in benchmark_tool:
7372
command_arr, command_str = prepareYCSBBenchmarkCommand(

redisbench_admin/run/redisgraph_benchmark_go/redisgraph_benchmark_go.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@ def prepareRedisGraphBenchmarkGoCommand(
4848
" ".join(queries_str)
4949
)
5050
)
51-
return queries_str
51+
command_str = " ".join(queries_str)
52+
return queries_str, command_str
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "UPDATE-BASELINE"
2+
remote:
3+
- setup: redisgraph-r5
4+
- type: oss-standalone
5+
dbconfig:
6+
- dataset: "datasets/single_node.rdb"
7+
clientconfig:
8+
- tool: redisgraph-benchmark-go
9+
- parameters:
10+
- graph: "g"
11+
- rps: 0
12+
- clients: 32
13+
- threads: 4
14+
- connections: 32
15+
- requests: 1000000
16+
- queries:
17+
- { q: "MATCH (n) WHERE ID(n) = 0 SET n.v = n.v + 1", ratio: 1 }
18+
kpis:
19+
- le: { $.OverallClientLatencies.Total.q50: 2.0 }
20+
- ge: { $.OverallQueryRates.Total: 18000 }

tests/test_redisgraph_benchmark_go.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import yaml
2+
3+
from redisbench_admin.run.redisgraph_benchmark_go.redisgraph_benchmark_go import prepareRedisGraphBenchmarkGoCommand
4+
5+
6+
def test_prepare_redis_graph_benchmark_go_command():
7+
with open("./tests/test_data/redisgraph-benchmark-go.yml", "r") as yml_file:
8+
benchmark_config = yaml.safe_load(yml_file)
9+
for k in benchmark_config["clientconfig"]:
10+
if 'parameters' in k:
11+
command_arr, command_str = prepareRedisGraphBenchmarkGoCommand("redisgraph-benchmark-go", "localhost", "6380", k, "result.txt")
12+
assert command_str == "redisgraph-benchmark-go -graph-key g -rps 0 -c 32 -n 1000000 -query MATCH (n) WHERE ID(n) = 0 SET n.v = n.v + 1 -query-ratio 1 -h localhost -p 6380 -json-out-file result.txt"

tests/test_remote.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from redisbench_admin.utils.remote import extract_git_vars
1+
from redisbench_admin.utils.remote import extract_git_vars, fetchRemoteSetupFromConfig
22

33

44
def test_extract_git_vars():
@@ -46,3 +46,8 @@ def test_extract_git_vars_passing_repo3():
4646
if github_branch_detached is False:
4747
assert github_actor != None and github_branch != ""
4848
assert github_branch != None and github_branch != ""
49+
50+
51+
def test_fetch_remote_setup_from_config():
52+
terraform_working_dir, type = fetchRemoteSetupFromConfig([{"type":"oss-standalone"},{"setup":"redistimeseries-m5d"}])
53+
assert type == "oss-standalone"

0 commit comments

Comments
 (0)