Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

pvf: use test-utils feature to export test only #7538

Conversation

jpserrat
Copy link
Contributor

@jpserrat jpserrat commented Jul 22, 2023

Adding the test-utils feature for pvf. I've decided to leave the testing module with doc(hidden) and add the test-utils feature directly to the functions within the module. Made this decision because the testing module is exporting spawn_with_program_path, which is used inside the integration tests. Please let me know if there is a better way to do this.

Related

closes #7285

Cumulus companion: paritytech/cumulus#2989


adder = { package = "test-parachain-adder", path = "../../../parachain/test-parachains/adder" }
halt = { package = "test-parachain-halt", path = "../../../parachain/test-parachains/halt" }

[features]
ci-only-tests = []
test-utils = []
Copy link
Member

Choose a reason for hiding this comment

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

One comment please on how to use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'm going to add. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ggwpez Comment added. Is this what you had in mind?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding comments. 🙌 But I think it is not entirely correct. The feature is not just for exporting code but also for building the puppet worker which is part of this crate.

node/core/pvf/Cargo.toml Show resolved Hide resolved
Copy link
Contributor

@mrcnski mrcnski left a comment

Choose a reason for hiding this comment

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

Amazing, thank you! Seems to mostly work apart from some tweaks that need to be made. Also left a couple suggestions for improvement.

node/core/pvf/src/testing.rs Outdated Show resolved Hide resolved
node/core/pvf/src/testing.rs Outdated Show resolved Hide resolved

adder = { package = "test-parachain-adder", path = "../../../parachain/test-parachains/adder" }
halt = { package = "test-parachain-halt", path = "../../../parachain/test-parachains/halt" }

[features]
ci-only-tests = []
test-utils = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding comments. 🙌 But I think it is not entirely correct. The feature is not just for exporting code but also for building the puppet worker which is part of this crate.

node/core/pvf/Cargo.toml Show resolved Hide resolved
@mrcnski mrcnski mentioned this pull request Aug 1, 2023
3 tasks
@mrcnski mrcnski added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. labels Aug 2, 2023
Copy link
Contributor

@mrcnski mrcnski left a comment

Choose a reason for hiding this comment

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

Love it! The doc(hidden)s were bugging me for the longest time.

@mrcnski
Copy link
Contributor

mrcnski commented Aug 7, 2023

Tests are passing 🙌 so this is just waiting on one more review.

@jpserrat
Copy link
Contributor Author

jpserrat commented Aug 7, 2023

Thanks for the help with this one!

@mrcnski mrcnski requested a review from slumber August 8, 2023 07:04
@slumber
Copy link
Contributor

slumber commented Aug 8, 2023

Note that this PR requires cumulus companion.

pub mod testing;

// Used by `decl_puppet_worker_main!`.
#[doc(hidden)]
#[cfg(feature = "test-utils")]
pub use sp_tracing;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the dependency itself become optional too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, in this case, the dependency will only be enabled if the test-utils feature is being used.

Copy link
Contributor

Choose a reason for hiding this comment

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

It will be re-exported with the feature, however it's always there in toml file:

sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }

My question is could it be made optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the misunderstanding. Done.

@mrcnski mrcnski added A4-companion A PR that needs a companion PR to merge in parallel for one of its downstream dependencies. E5-needs_cumulus_pr This is an issue that needs to be implemented upstream in Cumulus. and removed A4-companion A PR that needs a companion PR to merge in parallel for one of its downstream dependencies. labels Aug 8, 2023
@mrcnski
Copy link
Contributor

mrcnski commented Aug 8, 2023

@jpserrat Are you up to the task of creating a cumulus companion PR? There are instructions here (this is from the perspective of substrate -> polkadot, but it also applies when doing polkadot -> cumulus). If you don't have time I can take care of it.

@jpserrat
Copy link
Contributor Author

jpserrat commented Aug 8, 2023

@mrcnski I'm gonna do that.

@jpserrat jpserrat requested review from chevdor and a team as code owners August 9, 2023 11:52
@paritytech-ci paritytech-ci requested a review from a team August 9, 2023 11:52
Copy link
Contributor

@mrcnski mrcnski left a comment

Choose a reason for hiding this comment

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

Why did you make the latest changes here? 735344a We want to always build the worker binaries, it shouldn't be gated behind a feature.

Only the test-only puppet workers should be gated behind it.

@jpserrat
Copy link
Contributor Author

jpserrat commented Aug 9, 2023

Ok, I'll remove it. It was cause I notice that the code for the workers was a dependency for polkadot, so I thought that I should remove it from there as well and put it as optional. I'm making the change now.

@mrcnski
Copy link
Contributor

mrcnski commented Aug 9, 2023

Thanks @jpserrat! Yeah polkadot depends on the workers but they're not optional. I can see how the code structure is confusing, it should be documented, I'll write up an issue.

@slumber
Copy link
Contributor

slumber commented Aug 9, 2023

Still missing companion for cumulus

@jpserrat
Copy link
Contributor Author

jpserrat commented Aug 9, 2023

Doing that now.

Copy link
Contributor

@s0me0ne-unkn0wn s0me0ne-unkn0wn left a comment

Choose a reason for hiding this comment

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

LVGTM 👍

@mrcnski
Copy link
Contributor

mrcnski commented Aug 13, 2023

bot merge

@paritytech-processbot
Copy link

Error: Statuses failed for 6c46d31

@mrcnski
Copy link
Contributor

mrcnski commented Aug 14, 2023

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 9417f16 into paritytech:master Aug 14, 2023
3 checks passed
s0me0ne-unkn0wn pushed a commit that referenced this pull request Aug 15, 2023
* pvf: use test-utils feature to export test only

* adding comment to test-utils feature

* make prepare-worker and execute-worker as optional dependencies and add comments to test-utils

* remove doc hidden from pvf testing

* add prepare worker and execute worker entrypoints to test-utils feature

* pvf: add sp_tracing as optional dependency of test-utils

* add test-utils for polkadot and malus

* add test-utils feature to prepare and execute workers script

* remove required features from prepare and executing

* Try to trigger CI again to fix broken jobs

---------

Co-authored-by: Marcin S <marcin@realemail.net>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. E5-needs_cumulus_pr This is an issue that needs to be implemented upstream in Cumulus.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PVF: add test-utils feature and remove #[doc(hidden)]
5 participants