Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --debug option to run scenarios for faster development #612

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

pinheadmz
Copy link
Contributor

This PR also refactors warnet logs and warnet logs -f to remove dependence on kubectl.

The --debug flag, when added to warnet run <scenario>:

  • deploys the commander like usual
  • streams the log output of the commander to stdout while it runs
  • deletes the commander pod when user interrupts with ctrl-C
  • OR deletes the commander pod when scenario is complete / success / fail

Note that the --debug flag does not interfere with extra args passed to the scenario itself!

Examples:

scenario self destructs


(.venv) --> warnet run test/data/scenario_buggy_failure.py --debug
Successfully started scenario: scenario_buggy_failure
Commander pod name: commander-scenariobuggyfailure-1726684435
Waiting for commander pod to start...
Failure  Adding TestNode #0 from pod tank-0001 with IP 10.1.35.210
Failure  Adding TestNode #1 from pod tank-0002 with IP 10.1.35.211
Failure  Adding TestNode #2 from pod tank-0003 with IP 10.1.35.212
Failure  Adding TestNode #3 from pod tank-0004 with IP 10.1.35.213
Failure  Adding TestNode #4 from pod tank-0005 with IP 10.1.35.214
Failure  Adding TestNode #5 from pod tank-0006 with IP 10.1.35.215
Failure  Adding TestNode #6 from pod tank-0007 with IP 10.1.35.216
Failure  Adding TestNode #7 from pod tank-0008 with IP 10.1.35.217
Failure  Adding TestNode #8 from pod tank-0009 with IP 10.1.35.218
Failure  Adding TestNode #9 from pod tank-0010 with IP 10.1.35.219
Failure  Adding TestNode #10 from pod tank-0011 with IP 10.1.35.220
Failure  User supplied random seed 131260415370612
Failure  PRNG seed is: 131260415370612
Failure  Unexpected exception caught during testing
Traceback (most recent call last):
  File "/test_framework/test_framework.py", line 131, in main
    self.run_test()
  File "/scenario.py", line 20, in run_test
    raise Exception("Failed execution!")
Exception: Failed execution!
Failure  Stopping nodes
Failure  Not cleaning up dir /tmp/bitcoin_func_test_v9j7p8ht
Failure  Test failed. Test logging available at /tmp/bitcoin_func_test_v9j7p8ht/test_framework.log
Failure
Failure  Hint: Call /combine_logs.py '/tmp/bitcoin_func_test_v9j7p8ht' to consolidate all logs
Failure
Failure  If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
Failure
Failure
Deleting pod...
pod "commander-scenariobuggyfailure-1726684435" deleted

scenario is cancelled by user with ctrl-c


(.venv) --> warnet run resources/scenarios/miner_std.py --interval=1 --allnodes --debug
Successfully started scenario: miner_std
Commander pod name: commander-minerstd-1726684605
Waiting for commander pod to start...
MinerStd Adding TestNode #0 from pod tank-0001 with IP 10.1.35.210
MinerStd Adding TestNode #1 from pod tank-0002 with IP 10.1.35.211
MinerStd Adding TestNode #2 from pod tank-0003 with IP 10.1.35.212
MinerStd Adding TestNode #3 from pod tank-0004 with IP 10.1.35.213
MinerStd Adding TestNode #4 from pod tank-0005 with IP 10.1.35.214
MinerStd Adding TestNode #5 from pod tank-0006 with IP 10.1.35.215
MinerStd Adding TestNode #6 from pod tank-0007 with IP 10.1.35.216
MinerStd Adding TestNode #7 from pod tank-0008 with IP 10.1.35.217
MinerStd Adding TestNode #8 from pod tank-0009 with IP 10.1.35.218
MinerStd Adding TestNode #9 from pod tank-0010 with IP 10.1.35.219
MinerStd Adding TestNode #10 from pod tank-0011 with IP 10.1.35.220
MinerStd User supplied random seed 131260415370612
MinerStd PRNG seed is: 131260415370612
MinerStd Starting miners.
MinerStd generated 1 block(s) from node 0. New chain height: 189
MinerStd generated 1 block(s) from node 1. New chain height: 190
MinerStd generated 1 block(s) from node 2. New chain height: 191
MinerStd generated 1 block(s) from node 3. New chain height: 192
^CInterrupted streaming log!
Deleting pod...
pod "commander-minerstd-1726684605" deleted

@bdp-DrahtBot
Copy link
Collaborator

bdp-DrahtBot commented Sep 19, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #621 (Make test_framework available for users when creating scenarios by pinheadmz)
  • #616 (Kubeconfig Step Thru by mplsgrant)
  • #614 (swap out kubectl by mplsgrant)
  • #598 (Add cmd for creating user kubeconfigs (cont. from add create-kubeconfigs command #545) by josibake)
  • #576 (rpc: add regex pattern filtering to warnet logs rpc by ismaelsadeeq)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@pinheadmz
Copy link
Contributor Author

rebased on main

@m3dwards
Copy link
Collaborator

Worked for me. Nice.

@m3dwards m3dwards merged commit 9e890ed into bitcoin-dev-project:main Sep 27, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants