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(contract-e2e): auto-source substrate-contracts-node with e2e tests #254

Merged
merged 16 commits into from
Jul 25, 2024

Conversation

peterwht
Copy link
Contributor

@peterwht peterwht commented Jul 18, 2024

Solves #247

  • pop test contract --features e2e-tests is now deprecated in favor of pop test contract --e2e.
  • pop test contract --e2e will now download (if needed) substrate-contracts-node for usage in e2e tests.
    • If the substrate-contracts-node standalone command exists, this will be used.
    • Otherwise, the binary will be downloaded to the pop cache.
  • pop up contract was refactored to use the existing functionality for sourcing binaries in pop-parachains.

Merge Prerequisite: #258

Review this PR first before #258. #258 moves the sourcing functionality to pop-common.

Copy link

codecov bot commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 78.06216% with 120 lines in your changes missing coverage. Please review.

Project coverage is 70.63%. Comparing base (c776588) to head (af8e5a9).
Report is 3 commits behind head on main.

@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
- Coverage   70.81%   70.63%   -0.18%     
==========================================
  Files          47       50       +3     
  Lines        7664     7881     +217     
  Branches     7664     7881     +217     
==========================================
+ Hits         5427     5567     +140     
- Misses       1315     1374      +59     
- Partials      922      940      +18     
Files Coverage Δ
crates/pop-cli/src/commands/up/parachain.rs 7.55% <ø> (ø)
crates/pop-cli/src/main.rs 45.33% <ø> (ø)
crates/pop-common/src/errors.rs 0.00% <ø> (ø)
crates/pop-contracts/src/errors.rs 0.00% <ø> (ø)
crates/pop-parachains/src/errors.rs 0.00% <ø> (ø)
crates/pop-parachains/src/up/chain_specs.rs 83.33% <ø> (ø)
crates/pop-parachains/src/up/mod.rs 87.52% <100.00%> (-0.54%) ⬇️
crates/pop-parachains/src/up/parachains.rs 86.38% <ø> (ø)
crates/pop-parachains/src/up/relay.rs 85.71% <ø> (+0.34%) ⬆️
crates/pop-cli/src/commands/mod.rs 17.39% <0.00%> (ø)
... and 10 more

... and 1 file with indirect coverage changes

peterwht and others added 2 commits July 19, 2024 09:48
…#255)

* refactor(up-contract): use Binary struct from parachains -> up -> sourcing to auto-launch contracts-node

* refactor(contracts_node): reduce duplicated code -- checkpoint, not working

* refactor(contracts_node): use Binary and Source structs for substrate-contracts-node

* chore: small changes
@peterwht peterwht marked this pull request as ready for review July 19, 2024 21:37
@evilrobot-01 evilrobot-01 linked an issue Jul 20, 2024 that may be closed by this pull request
2 tasks
Copy link
Contributor

@evilrobot-01 evilrobot-01 left a comment

Choose a reason for hiding this comment

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

Looks great! A few minor suggestions, but need the missing help comment added and I had a weird quick having contracts-node already installed via cargo which meant a poorer experience. See comments for more details.

crates/pop-cli/src/commands/test/contract.rs Show resolved Hide resolved
crates/pop-cli/src/commands/test/contract.rs Outdated Show resolved Hide resolved
crates/pop-contracts/src/utils/contracts_node.rs Outdated Show resolved Hide resolved
crates/pop-cli/src/commands/test/contract.rs Outdated Show resolved Hide resolved
crates/pop-contracts/src/utils/contracts_node.rs Outdated Show resolved Hide resolved
crates/pop-cli/src/commands/test/contract.rs Outdated Show resolved Hide resolved
@peterwht
Copy link
Contributor Author

Introduced a new common module under pop-cli. A helper function was defined that checks if contracts-node exists, if not, it will prompt to download it.

@AlexD10S
Copy link
Collaborator

Looking good, will review again with this merged: #258 before approve

* refactor(sourcing): move sourcing to pop-common

* refactor(sourcing-tests): move sourcing tests to pop-common

* refactor(sourcing): better imports

* refactor(sourcing): clean sourcing module with better component categorization. Other cleanups
@AlexD10S
Copy link
Collaborator

Looking good, will review again with this merged: #258 before approve

Something wrong after the merge, that tests are failing

@AlexD10S AlexD10S self-requested a review July 24, 2024 09:00
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.

Tests are passing now.
Some decisions need to be made before merging:

@peterwht
Copy link
Contributor Author

Tests are passing now. Some decisions need to be made before merging:

  1. I leave final decision up to you, Alex. But I think just using the Pop cache binary seems like a reasonable approach.
  2. I consider PR feat: consistency with pop up parachains to handle versioning for contracts-node #262 a feature (not a refactor) as it adds new functionality. So, I would say merge this one, then merge the next. However, I am good with either way.

Copy link
Contributor

@evilrobot-01 evilrobot-01 left a comment

Choose a reason for hiding this comment

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

A minor fix required to the UX and the use of the cache directory for tests need to be improved, as it may currently leave artifacts on users machine if test fails.

See also #263 for additional improvements.

crates/pop-cli/src/common/contracts.rs Show resolved Hide resolved
crates/pop-cli/tests/contract.rs Outdated Show resolved Hide resolved
crates/pop-common/src/helpers.rs Outdated Show resolved Hide resolved
crates/pop-contracts/src/call.rs Outdated Show resolved Hide resolved
crates/pop-contracts/src/up.rs Outdated Show resolved Hide resolved
crates/pop-contracts/src/utils/contracts_node.rs Outdated Show resolved Hide resolved
crates/pop-cli/src/commands/test/contract.rs Outdated Show resolved Hide resolved
evilrobot-01 and others added 3 commits July 25, 2024 06:30
* fix: use async sleep in async context

* refactor: remove unnecessary module

* refactor: standardise sourcing ux
Copy link
Contributor

@evilrobot-01 evilrobot-01 left a comment

Choose a reason for hiding this comment

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

Awesome, thank you for bearing with me. 🙂

@AlexD10S AlexD10S merged commit 5d2a940 into main Jul 25, 2024
12 of 18 checks passed
@AlexD10S AlexD10S deleted the peter/feat-e2e-test-improvements branch July 25, 2024 17:45
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.

improve e2e test experience
3 participants