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

feat: add ability to run a script once network is initialized #180

Merged
merged 13 commits into from
May 23, 2024

Conversation

brunopgalvao
Copy link
Contributor

@brunopgalvao brunopgalvao commented May 16, 2024

Simple test:

cargo run up parachain -f ./tests/zombienet.toml -p https://github.com/r0gue-io/pop-node --cmd "echo Hello from Pop CLI"

Copy link

codecov bot commented May 16, 2024

Codecov Report

Attention: Patch coverage is 82.75862% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 50.61%. Comparing base (48eec26) to head (c9f9345).
Report is 6 commits behind head on main.

@@            Coverage Diff             @@
##             main     #180      +/-   ##
==========================================
+ Coverage   49.69%   50.61%   +0.91%     
==========================================
  Files          32       32              
  Lines        2785     2857      +72     
  Branches     2785     2857      +72     
==========================================
+ Hits         1384     1446      +62     
- Misses       1182     1186       +4     
- Partials      219      225       +6     
Files Coverage Δ
crates/pop-cli/src/commands/up/parachain.rs 18.18% <82.75%> (+18.18%) ⬆️

... and 4 files with indirect coverage changes

tests/zombienet.toml Outdated Show resolved Hide resolved
@brunopgalvao brunopgalvao marked this pull request as ready for review May 17, 2024 10:54
Copy link
Collaborator

@AlexD10S AlexD10S left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments:

  • We need to explain this option in the README and if is with an useful example on how can be useful for devs much better.
  • If I run the example --cmd "echo Hello from Pop CLI" as you suggest for a quick test it looks a bit weird, it gets stuck for a few seconds in Running command: echo Hello from Pop CLI... without really executing it and after it clear the screen to display the information of the pop up. UX has to be improved, maybe showing the message that is running the command after spawn the networks?
  • I left a comment about parsing the arguments of the script: pop up -cmd "echo" --args ...

@peterwht
Copy link
Contributor

This would be good to test with a simple Subxt script that connects to the launched network.

@brunopgalvao
Copy link
Contributor Author

This would be good to test with a simple Subxt script that connects to the launched network.

Created a simple script.

git clone https://github.com/brunopgalvao/set-balance
cd set-balance
cargo build

./tests/zombienet.toml

[relaychain]
chain = "rococo-local"

[[relaychain.nodes]]
name = "alice"
rpc_port = 8833
validator = true

[[relaychain.nodes]]
name = "bob"
validator = true
pop up parachain -f ./tests/zombienet.toml -r v1.8.0 -p --cmd /Users/bruno/src/set-balance/target/debug/set-balance

Output
Screenshot 2024-05-22 at 5 25 45 PM

Screenshot 2024-05-22 at 5 26 13 PM

@AlexD10S
Copy link
Collaborator

AlexD10S commented May 22, 2024

This would be good to test with a simple Subxt script that connects to the launched network.

Thanks, LGTM now!
This example makes it easier to test the function. I have added an issue in the documentation to convert this example into a tutorial: r0gue-io/pop-docs#2

@brunopgalvao brunopgalvao requested a review from peterwht May 23, 2024 07:01
@brunopgalvao brunopgalvao merged commit 7da805f into main May 23, 2024
14 checks passed
@brunopgalvao brunopgalvao deleted the bruno/pop-init branch May 23, 2024 07:27
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.

4 participants