Skip to content

Commit

Permalink
fix: Small fix mirror script (near#10095)
Browse files Browse the repository at this point in the history
Small fix of prefix module for `run_cmd` in `mirror.py` script
  • Loading branch information
Jure Bajic authored Nov 3, 2023
1 parent ea8cb09 commit c4868c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pytest/tests/mocknet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Mirror transactions from a given network into a custom mocktest network and add
2. Run `python3 tests/mocknet/mirror.py --chain-id {chain_id} --start-height {start_height} --unique-id {unique_id} init-neard-runner`, replacing the `{}`s with appropriate values from the `nearcore/pytest` directory. This starts a helper program on each node that will be in charge of the test state and neard process.
3. Run `python3 tests/mocknet/mirror.py --chain-id {chain_id} --start-height {start_height} --unique-id {unique_id} new-test`. This will take a few hours.
4. Run `python3 tests/mocknet/mirror.py --chain-id {chain_id} --start-height {start_height} --unique-id {unique_id} start-traffic` replacing the `{}`s with appropriate values
4. Monitoring
5. Monitoring
- See metrics on grafana mocknet https://grafana.near.org/d/jHbiNgSnz/mocknet?orgId=1&refresh=30s&var-chain_id=All&var-node_id=.*unique_id.*&var-account_id=All replacing the "unique_id" with the value from earlier

If there's ever a problem with the neard runners on each node, for example if you get a connection error running the `status` command, run the `restart-neard-runner` command to restart them, which should be safe to do.

To run a locust load test on the mocknet network, run `python3 tests/mocknet/locust.py init --instance-names {}`, where
the instance names are VMs that have been prepared for this purpose, and then run `python3 tests/mocknet/locust.py run --master {master_instance_name} --workers {worker_instance_name0,worker_instance_name1,etc...} --funding-key {key.json} --node-ip-port {mocknet_node_ip}:3030`, where `mocknet_node_ip` is an IP address of a node that's been setup by the mirror.py script, and `key.json` is an account key that contains lots of NEAR for this load test. TODO: add extra accounts for load testing purposes during the mocknet setup step
the instance names are VMs that have been prepared for this purpose, and then run `python3 tests/mocknet/locust.py run --master {master_instance_name} --workers {worker_instance_name0,worker_instance_name1,etc...} --funding-key {key.json} --node-ip-port {mocknet_node_ip}:3030`, where `mocknet_node_ip` is an IP address of a node that's been setup by the mirror.py script, and `key.json` is an account key that contains lots of NEAR for this load test. TODO: add extra accounts for load testing purposes during the mocknet setup step
2 changes: 1 addition & 1 deletion pytest/tests/mocknet/mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def neard_runner_jsonrpc(node, method, params=[]):
# followed by a new quote started with ' and the rest of the string, to get any single quotes
# in method or params into the command correctly
body = body.replace("'", "'\"'\"'")
r = run_cmd(node, f'curl localhost:3000 -d \'{body}\'')
r = cmd_utils.run_cmd(node, f'curl localhost:3000 -d \'{body}\'')
response = json.loads(r.stdout)
if 'error' in response:
# TODO: errors should be handled better here in general but just exit for now
Expand Down

0 comments on commit c4868c1

Please sign in to comment.