|
8 | 8 | split_tags_string, |
9 | 9 | get_or_None, |
10 | 10 | ) |
11 | | -from redisbench_admin.run.common import get_start_time_vars, prepare_benchmark_parameters |
| 11 | +from redisbench_admin.run.common import get_start_time_vars, prepare_benchmark_parameters, \ |
| 12 | + extract_benchmark_tool_settings, common_exporter_logic, process_default_yaml_properties_file |
12 | 13 |
|
13 | 14 |
|
14 | 15 | class Test(TestCase): |
@@ -54,8 +55,34 @@ def test_get_start_time_vars(): |
54 | 55 | def test_prepare_benchmark_parameters(): |
55 | 56 | with open("./tests/test_data/ycsb-config.yml", "r") as yml_file: |
56 | 57 | benchmark_config = yaml.safe_load(yml_file) |
57 | | - command_arr, command_str = prepare_benchmark_parameters(benchmark_config, "ycsb", "6380", "localhost", |
| 58 | + command_arr, command_str = prepare_benchmark_parameters(benchmark_config, "ycsb", "6380", "localhost", |
58 | 59 | "out.txt", False) |
59 | 60 | assert command_str == "ycsb load redisearch -P workloads/workload-ecommerce -p \"threadcount=64\"" \ |
60 | 61 | " -p \"redis.host=localhost\" -p \"redis.port=6380\"" \ |
61 | 62 | " -p \"recordcount=100000\" -p \"operationcount=100000\"" |
| 63 | + |
| 64 | + |
| 65 | +def test_extract_benchmark_tool_settings(): |
| 66 | + config_files = ["./tests/test_data/ycsb-config.yml", "./tests/test_data/redis-benchmark.yml", |
| 67 | + "./tests/test_data/redisgraph-benchmark-go.yml"] |
| 68 | + for file in config_files: |
| 69 | + with open(file, "r") as yml_file: |
| 70 | + benchmark_config = yaml.safe_load(yml_file) |
| 71 | + benchmark_min_tool_version, benchmark_min_tool_version_major, benchmark_min_tool_version_minor, benchmark_min_tool_version_patch, benchmark_tool, benchmark_tool_source = extract_benchmark_tool_settings( |
| 72 | + benchmark_config) |
| 73 | + assert benchmark_tool is not None |
| 74 | + prepare_benchmark_parameters(benchmark_config, benchmark_tool, "9999", "localhost", "out.txt", False) |
| 75 | + |
| 76 | + |
| 77 | +def test_common_exporter_logic(): |
| 78 | + # negative test |
| 79 | + common_exporter_logic(None, None, None, None, None, None, |
| 80 | + None, None, None, None) |
| 81 | + |
| 82 | + |
| 83 | +def test_process_default_yaml_properties_file(): |
| 84 | + with open("./tests/test_data/common-properties-v0.1.yml", "r") as yml_file: |
| 85 | + default_kpis, default_metrics, exporter_timemetric_path = process_default_yaml_properties_file({},{},"1.yml",None,yml_file) |
| 86 | + assert exporter_timemetric_path == "$.StartTime" |
| 87 | + assert default_kpis is None |
| 88 | + |
0 commit comments