From c3a0eb0aeb5de4f361de1dc4ed32057328b4c498 Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Thu, 12 Oct 2023 14:30:33 +0000 Subject: [PATCH] fmt --- CMakeLists.txt | 3 +-- tests/client_tracing.py | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 81badc1a48c3..e99801ce8276 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1378,8 +1378,7 @@ if(BUILD_TESTS) add_e2e_test( NAME client_tracing PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/client_tracing.py - ADDITIONAL_ARGS --js-app-bundle - ${CMAKE_SOURCE_DIR}/samples/apps/basic/js + ADDITIONAL_ARGS --js-app-bundle ${CMAKE_SOURCE_DIR}/samples/apps/basic/js ) add_e2e_test( diff --git a/tests/client_tracing.py b/tests/client_tracing.py index c7d9006bf736..5629b027261a 100644 --- a/tests/client_tracing.py +++ b/tests/client_tracing.py @@ -4,6 +4,7 @@ import infra.network + class ClientTracing: processes = {} index = 0 @@ -11,7 +12,7 @@ class ClientTracing: def __init__(self, client) -> None: self.client = client - if not client.hostname in ClientTracing.processes: + if client.hostname not in ClientTracing.processes: ClientTracing.processes[client.hostname] = len(ClientTracing.processes) self.process = ClientTracing.processes[client.hostname] @@ -22,7 +23,7 @@ def write(self, key, value): "f": "txn", "value": [["w", key, value]], "process": self.process, - "index": ClientTracing.index + "index": ClientTracing.index, } ClientTracing.steps.append(trace) r = self.client.put(f"/records/{key}", f"{value}") @@ -33,7 +34,7 @@ def write(self, key, value): "f": "txn", "value": [["w", key, value]], "process": self.process, - "index": ClientTracing.index + "index": ClientTracing.index, } ClientTracing.steps.append(trace) @@ -44,7 +45,7 @@ def read(self, key): "f": "txn", "value": [["r", key, None]], "process": self.process, - "index": ClientTracing.index + "index": ClientTracing.index, } ClientTracing.steps.append(trace) r = self.client.get(f"/records/{key}") @@ -56,20 +57,17 @@ def read(self, key): "f": "txn", "value": [["r", key, value]], "process": self.process, - "index": ClientTracing.index + "index": ClientTracing.index, } ClientTracing.steps.append(trace) + def run_rw_register_trace(args): with infra.network.network( - args.nodes, - args.binary_dir, - args.debug_nodes, - args.perf_nodes, - pdb=args.pdb + args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb ) as network: network.start_and_open(args) - + primary, _ = network.find_primary() with primary.client("user0") as c: cw = ClientTracing(c) @@ -80,8 +78,9 @@ def run_rw_register_trace(args): with open("trace.json", "w") as f: f.write(json.dumps(ClientTracing.steps)) + if __name__ == "__main__": args = infra.e2e_args.cli_args() args.nodes = infra.e2e_args.min_nodes(args, f=0) - run_rw_register_trace(args) \ No newline at end of file + run_rw_register_trace(args)