Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
achamayou committed Oct 12, 2023
1 parent 94b4ec0 commit c3a0eb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
23 changes: 11 additions & 12 deletions tests/client_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

import infra.network


class ClientTracing:
processes = {}
index = 0
steps = []

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]

Expand All @@ -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}")
Expand All @@ -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)

Expand All @@ -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}")
Expand All @@ -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)
Expand All @@ -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)
run_rw_register_trace(args)

0 comments on commit c3a0eb0

Please sign in to comment.