Skip to content

Commit

Permalink
More changes
Browse files Browse the repository at this point in the history
  • Loading branch information
spuiuk committed Apr 8, 2024
1 parent 4a6a11b commit 4639a4f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions testcases/loading/test_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ def stop_tests(self):


def print_stats(header: str, stats: typing.Dict[str, int]) -> None:
ret = header
""" Helper function to print out process stats """
ret = header + " "
ret += f'read: {stats.get("read", 0)} '
ret += f'write: {stats.get("write", 0)} '
ret += f'delete: {stats.get("delete", 0)} '
Expand All @@ -253,16 +254,16 @@ def print_stats(header: str, stats: typing.Dict[str, int]) -> None:
print(ret)


# Start function for test processes
def start_process(
process_number: int,
numcons: int,
ret_queue: Queue,
mount_params: typing.Dict[str, str],
testdir: str,
) -> None:
""" Start function for test processes """
loadtest: LoadTest = LoadTest(
mount_params["server"],
mount_params["host"],
mount_params["share"],
mount_params["username"],
mount_params["password"],
Expand All @@ -274,10 +275,12 @@ def start_process(
total_stats: dict[str, int] = loadtest.total_stats()
total_stats["process_number"] = process_number
total_stats["number_connections"] = numcons
# Push process stats to the main process
ret_queue.put(total_stats)


def generate_loading_check() -> typing.List[tuple[str, str]]:
""" return a list of tuples containig hostname and sharename to test """
arr = []
for sharename in testhelper.get_exported_shares(test_info):
share = testhelper.get_share(test_info, sharename)
Expand Down Expand Up @@ -337,15 +340,15 @@ def test_loading(hostname: str, sharename: str) -> None:
stats = ret_queue.get()
print_stats(
f'Process #{stats["process_number"]} '
+ f'{stats["number_connections"]} Connections: ',
+ f'{stats.get("number_connections", 0)} Connections:',
stats,
)
total_stats["read"] += stats.get("read", 0)
total_stats["write"] += stats.get("write", 0)
total_stats["delete"] += stats.get("delete", 0)
total_stats["error"] += stats.get("error", 0)
total_stats["client_error"] += stats.get("client_error", 0)
print_stats("Total: ", total_stats)
print_stats("Total:", total_stats)

for process_number in range(total_processes):
process_testdir = f"{testdir}/p{process_number}"
Expand Down

0 comments on commit 4639a4f

Please sign in to comment.