-
Notifications
You must be signed in to change notification settings - Fork 619
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
feat(mocknet): add scripts to test mocknet itself locally #10835
Conversation
…et_cmd() not really necessary, since init_neard_runner() calls stop_neard_runner(), and stop_neard_runner() will stop the neard nodes. and we probably don't ever want to use this unrelated mocknet.stop_nodes() anyway
@posvyatokum sorry it is a bit large. I tried to separate it into different commits to make it easier to review. It should all "just work" if everything is right, but note that it sometimes fails for me with neard built from master because of this: #10827. If you try it with 1.38.0 it should work. Also, I have indeed used this extensively on "real" mocknet, so it has been tested a good amount already for what it's worth |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #10835 +/- ##
=======================================
Coverage 71.53% 71.53%
=======================================
Files 758 758
Lines 151686 151686
Branches 151686 151686
=======================================
+ Hits 108512 108515 +3
+ Misses 38684 38682 -2
+ Partials 4490 4489 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the idea, love the breakdown of mirror.py
.
This ties to the idea of "Forknet=Nayduck with mocknet backend" by separating test orchestration and node handling.
Will say that in localnet pytests that we have in Nayduck this is done differently by having
class BaseNode
class RpcNode(BaseNode)
class LocalNode(BaseNode)
This is why I see another refactoring of this code in the future.
This splits out common functionality previously written out in mirror.py into a
NodeHandle
class, and then provides two implementations, one for real mocknet tests over SSH, and one for local testing that starts neard runner processes locally. This is helpful because without this, it can be very difficult to test changes to the mocknet scripts themselves, as starting a real mocknet test can be expensive and time consumingThe
local_test_node.py
file added here includes a command that can be used to set up a local test with state taken from a local near home directory. An example of how to use it is: