Skip to content

Commit 0d17e17

Browse files
misc(disk_perf): styling
Signed-off-by: Mathieu Labourier <[email protected]>
1 parent ec3dbad commit 0d17e17

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

tests/storage/benchmarks/conftest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from lib.commands import SSHCommandFailed
77
from .helpers import load_results_from_csv
88

9-
MAX_LENGTH = 64*(1024**3) # 64GiB
9+
MAX_LENGTH = 64 * (1024**3) # 64GiB
1010

1111
# use vhd, qcow2, raw... when image_format support will be available
1212
@pytest.fixture(scope="module", params=['vdi'])
@@ -30,7 +30,8 @@ def running_unix_vm_with_fio(running_unix_vm):
3030
vm.ssh(install_cmd, check=True)
3131
remove_cmd = remove
3232
break
33-
except SSHCommandFailed: ...
33+
except SSHCommandFailed:
34+
...
3435
else:
3536
raise RuntimeError("Unsupported package manager: could not install fio")
3637

@@ -100,4 +101,4 @@ def prev_results(request):
100101
results = {}
101102
if csv_path and os.path.exists(csv_path):
102103
load_results_from_csv(csv_path)
103-
return results
104+
return results

tests/storage/benchmarks/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ def load_results_from_csv(csv_path):
4545
def mean(data, key):
4646
return statistics.mean(
4747
[float(x[key]) for x in data if key in x]
48-
)
48+
)

tests/storage/benchmarks/test_disk_perf.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from lib.commands import SSHCommandFailed
1010
from .helpers import load_results_from_csv, log_result_csv, mean
1111

12-
### Tests default settings ###
12+
# Tests default settings #
1313

1414
CSV_FILE = f"/tmp/results_{datetime.now().strftime("%Y-%m-%d_%H:%M:%S")}.csv"
1515

@@ -20,21 +20,21 @@
2020
DEFAULT_NUMJOBS = 1
2121
DEFAULT_FILE = "fio-testfile"
2222

23-
### Tests parameters
23+
# Tests parameters #
2424

2525
system_memory = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')
2626

2727
block_sizes = ("4k", "16k", "64k", "1M")
28-
file_sizes = ("1G", "4G", f"{int((system_memory//(1024.**3))*2)}G")
28+
file_sizes = ("1G", "4G", f"{int((system_memory // (1024.**3)) * 2)}G")
2929

3030
modes = (
31-
"read",
32-
"randread",
33-
"write",
34-
"randwrite"
31+
"read",
32+
"randread",
33+
"write",
34+
"randwrite"
3535
)
3636

37-
### End of tests parameters ###
37+
# End of tests parameters #
3838

3939
def run_fio(
4040
vm,
@@ -87,7 +87,7 @@ def assert_performance_not_degraded(current, previous, threshold=10):
8787
except statistics.StatisticsError:
8888
logging.info(f"Missing metric ({metric}), skipping comparison")
8989
continue
90-
diff = (curr-prev if metric == "latency" else prev-curr) / (prev * 100)
90+
diff = (curr - prev if metric == "latency" else prev - curr) / (prev * 100)
9191
assert diff <= threshold, \
9292
f"{metric} changed by {diff:.2f}% (allowed {threshold}%)"
9393
diffs[metric] = diff
@@ -98,9 +98,6 @@ def assert_performance_not_degraded(current, previous, threshold=10):
9898
logging.info(f"- {k}: {sign}{abs(v):.2f}%")
9999

100100

101-
class TestDiskPerfDestroy: ...
102-
103-
104101
class TestDiskPerf:
105102
test_cases = itertools.product(block_sizes, file_sizes, modes)
106103

0 commit comments

Comments
 (0)