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 zombienet-sdk test to parachain-template #5342

Merged
merged 27 commits into from
Sep 16, 2024
Merged

Conversation

pepoviola
Copy link
Contributor

Add new CI machinery to smoke test the parachain-template-node using zombienet-sdk.
Thx!

@pepoviola pepoviola added R0-silent Changes should not be mentioned in any release notes T10-tests This PR/Issue is related to tests. labels Aug 13, 2024
@pepoviola pepoviola requested a review from a team as a code owner August 13, 2024 11:03
@pepoviola pepoviola requested a review from kianenigma August 13, 2024 11:07
@rzadp
Copy link
Contributor

rzadp commented Aug 13, 2024

Great news!

I see that the network config is defined inside the smoke test, so it doesn't really test that the zombienet.toml file, right? Would it be possible to change that?

I was actually working on a CI workflow in the separate template repo based on the old zombienet, which would be a part of the clone'able template as a starter point, and that would use zombienet.toml.

Do you think this zombienet-sdk test should be a part of the clone'able template, or only used here to test the binaries?
If the first - we should update the instructions and the config file from zombienet to zombienet-sdk.
If the second - we should have this new crate as a sibling of the template, so it doesn't get synchronized.

@rzadp
Copy link
Contributor

rzadp commented Aug 13, 2024

Oh and one more - do you think it would make sense to add a similar smoke test for the other two templates (only asserting the state of the relaychains)?

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

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

Would be great if you also check the run instructions in the README to be simple and correct.

@kianenigma
Copy link
Contributor

Oh and one more - do you think it would make sense to add a similar smoke test for the other two templates (only asserting the state of the relaychains)?

I was thinking of the same, and initially though it is not needed as you would usually run them with a single node, but better add it everywhere.

for the solochain I think it is a good idea.

for minimal, it makes less sense as it is meant to run with just one node. @pepoviola can try it out and see if it makes sense, but I think it doesn't.

@paritytech-review-bot paritytech-review-bot bot requested a review from a team August 13, 2024 14:44
@pepoviola
Copy link
Contributor Author

pepoviola commented Aug 13, 2024

Hi @rzadp / @kianenigma, thanks for the feedback! I will track these changes here:

  • Move the test to be a sibling of the other directories (parachain / minimal / etc).
  • Add a simple smoke test for every version (parachain / solochain / minimal).
  • Update readme with instructions to run everywhere.
  • feature gate the tests.

Thx!

Comment on lines 1 to 10
//! This test is setup to run with the `native` provider and needs these binaries in your PATH
//! `polkadot`, `polkadot-prepare-worker`, `polkadot-execute-worker`, `parachain-template-node`.
//! You can follow these steps to compile and export the binaries:
//! `cargo build --release -features fast-runtime --bin polkadot --bin polkadot-execute-worker --bin
//! polkadot-prepare-worker`
//! `cargo build --package parachain-template-node --release`
//! `export PATH=<path-to-polkadot-sdk-repo>/target/release:$PATH
//!
//! The you can run the test with
//! `cargo test -p parachain-template-zombienet`
Copy link
Member

Choose a reason for hiding this comment

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

So if someone is running cargo test in the repo, it will fail. Then they will be confused and at some point maybe find these docs. TBH, this is not any nice experience. Generally for running these tests it is not a nice experience.

I still don't get the need for writing them in Rust. This just makes it even more complicated than it already is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @bkchr, thanks for the feedback. I'm agree that the dx needs to improve and isn't in the final shape. Wdyt about make this test feature gated and even if you pass the feature run some sanity check to ensure the preconditions (e.g the binaries) are availables and if not print a nice guide about the requirements?

Copy link
Member

@shawntabrizi shawntabrizi Aug 14, 2024

Choose a reason for hiding this comment

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

i agree, it should probably be something like cargo test --features zombienet

Not sure if i have an opinion of rust / not rust.

it is nice that you dont need anything but rust to run zombienet in this situation.

rust is a bit more complicated, but that should not be limiting factor for developers who want to do this anyway.

Comment on lines 4 to 5
//! `cargo build --release -features fast-runtime --bin polkadot --bin polkadot-execute-worker --bin
//! polkadot-prepare-worker`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
//! `cargo build --release -features fast-runtime --bin polkadot --bin polkadot-execute-worker --bin
//! polkadot-prepare-worker`
//! `cargo install --git https://github.com/paritytech/polkadot-sdk/ --tag polkadot-stable2407
//! polkadot polkadot-execute-worker polkadot-prepare-worker`

Ideally we could automatically replace the tag here as the template updates

//! `cargo build --release -features fast-runtime --bin polkadot --bin polkadot-execute-worker --bin
//! polkadot-prepare-worker`
//! `cargo build --package parachain-template-node --release`
//! `export PATH=<path-to-polkadot-sdk-repo>/target/release:$PATH
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
//! `export PATH=<path-to-polkadot-sdk-repo>/target/release:$PATH

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You still need to have <path-to-polkadot-sdk-repo>/target/release in your PATH in order to run parachain-template-node, minimal-template-node, etc.

@pepoviola pepoviola changed the title add zombienet-sdk test to parachain-template [DNM] add zombienet-sdk test to parachain-template Aug 14, 2024
zombienet-sdk = "0.2.6"

[features]
zombienet = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this have a separate feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea is to hide this integration test behind a feature, since require some extra artifacts and steps and we don't want to mess with people running cargo test.

Copy link
Contributor

Choose a reason for hiding this comment

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

But if you run cargo test in a template, for example ./templates/parachain, this crate is not part of your working tree and is not tested anyways??

@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable 2/3
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7077463

@pepoviola pepoviola changed the title [DNM] add zombienet-sdk test to parachain-template add zombienet-sdk test to parachain-template Aug 20, 2024
@pepoviola
Copy link
Contributor Author

ping @kianenigma / @shawntabrizi can we merge this one? NOTE: I need to fix the sdk in order to work with the solochain template.
Thx!

Base automatically changed from rzadp-patch-1 to master August 23, 2024 11:26
zombienet-sdk = "0.2.8"

[features]
zombienet = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, this is not needed, as this crate is no longer part of templates/parachain. If you run cargo test in templates/parachain, this crate is not called.

Copy link
Contributor Author

@pepoviola pepoviola Aug 24, 2024

Choose a reason for hiding this comment

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

Thanks for the feedback @kianenigma! The idea behind the feature flag is to prevent failures in these tests for users that run cargo test --workspace in the polkadot-sdk repo, since this tests need some extra steps (build the binaries) in order to run. So, I think we can keep the feature and set in our CI to ensure block production for the templates.

Thx!

//! The you can run the test with
//! `cargo test -p template-zombienet-tests`

#[cfg(feature = "zombienet")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#[cfg(feature = "zombienet")]

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

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

The feature needs to be removed, otherwise looks good.

@pepoviola
Copy link
Contributor Author

Hi @kianenigma, just re-iterating on this. The feature flag is to prevent failures in these tests for users that run cargo test --workspace in the polkadot-sdk repo (without cding to the templates directory), since this tests need some extra steps (build the binaries) in order to run. So, I think we can keep the feature and set in our CI to ensure block production for the templates. wdyt?

Thx!

@pepoviola pepoviola enabled auto-merge September 16, 2024 18:27
@pepoviola pepoviola added this pull request to the merge queue Sep 16, 2024
Merged via the queue into master with commit 9307d99 Sep 16, 2024
206 of 207 checks passed
@pepoviola pepoviola deleted the rzadp-patch-1-1 branch September 16, 2024 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T10-tests This PR/Issue is related to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants