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(test): parallel unit test execution #379

Merged
merged 7 commits into from
Oct 30, 2024

Conversation

qalisander
Copy link
Member

@qalisander qalisander commented Oct 24, 2024

Refactoring for unit tests, that lets them run in parallel.
Every rust test has an associated thread name. Hence corresponding test mock data are stored in a DashMap (concurrent hashmap). Key is name of the thread (full name of the test). Value is mock onchain storage. In the future Value (MockStorage) will contain additionally fields for msg::sender, msg::value and so on..

Resolves #306

Copy link

netlify bot commented Oct 24, 2024

Deploy Preview for contracts-stylus canceled.

Name Link
🔨 Latest commit 7924d76
🔍 Latest deploy log https://app.netlify.com/sites/contracts-stylus/deploys/67224a3968f2c000086785f7

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 91.04478% with 6 lines in your changes missing coverage. Please review.

Project coverage is 69.1%. Comparing base (a7845f5) to head (7924d76).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/motsu/src/shims.rs 0.0% 4 Missing ⚠️
lib/motsu-proc/src/test.rs 92.3% 2 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
...ontracts/src/token/erc721/extensions/enumerable.rs 75.1% <ø> (-11.7%) ⬇️
contracts/src/utils/structs/bitmap.rs 86.0% <ø> (ø)
lib/motsu/src/context.rs 100.0% <100.0%> (ø)
lib/motsu-proc/src/test.rs 95.5% <92.3%> (-2.2%) ⬇️
lib/motsu/src/shims.rs 0.0% <0.0%> (ø)

... and 12 files with indirect coverage changes

@qalisander qalisander marked this pull request as ready for review October 24, 2024 12:25
@@ -24,7 +24,7 @@ jobs:
with:
target: wasm32-unknown-unknown
components: rust-src
toolchain: nightly-2024-01-01
toolchain: nightly-2024-07-25
Copy link
Member Author

@qalisander qalisander Oct 24, 2024

Choose a reason for hiding this comment

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

update nightly-2024-01-01 -> nightly-2024-07-25 was added, since cargo stylus cannot compile on the previous version

lib/motsu/src/context.rs Outdated Show resolved Hide resolved
lib/motsu/src/context.rs Outdated Show resolved Hide resolved
lib/motsu/src/context.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

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

Left some minor comments regarding naming.

lib/motsu-proc/src/test.rs Show resolved Hide resolved
lib/motsu/src/context.rs Show resolved Hide resolved
lib/motsu/src/context.rs Outdated Show resolved Hide resolved
lib/motsu/src/context.rs Outdated Show resolved Hide resolved
@qalisander qalisander merged commit 9c2b1b4 into main Oct 30, 2024
24 checks passed
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.

[Feature]: Allow unit tests to run in parallel
2 participants