-
Notifications
You must be signed in to change notification settings - Fork 480
Support custom environment in E2E tests #1645
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
Support custom environment in E2E tests #1645
Conversation
SkymanOne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README of the example contracts needs an update; and just few neatpicks from me.
Otherwise, looks good :)
[ink_e2e]: support custom environment
Codecov Report
@@ Coverage Diff @@
## master #1645 +/- ##
==========================================
- Coverage 70.72% 70.69% -0.03%
==========================================
Files 206 206
Lines 6404 6416 +12
==========================================
+ Hits 4529 4536 +7
- Misses 1875 1880 +5
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
HCastano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only took a quick look, will review again tomorrow
|
Are block_time in this llink which is |
|
@ganesh1233456 these are very different things; |
| } | ||
|
|
||
| #[test] | ||
| fn duplicate_environment_fails() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would also be cool to see some UI tests for the E2E macros, but that would be for a future PR
HCastano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there!
examples/custom-environment/lib.rs
Outdated
| } | ||
| } | ||
|
|
||
| #[cfg(all(test, feature = "e2e-tests", feature = "permissive-node"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also be curious to know what happens if we try and run an E2E test with a custom env on a node that doesn't use one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test added
HCastano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
|
@SkymanOne since you requested changes we still need another review from you before merging |
SkymanOne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This PR allows specifying a custom environment for an e2e test with:
For an example, see
examples/custom-environment.Message building
Currently,
ink_e2eexposes two APIs for message building:MessageBuilderthat is already generic over environmentbuild_messagethat preparesMessageBuilderforDefaultEnvironmentGenerally,
build_messageis nothing more thanMessageBuilder::<DefaultEnvironment, Ref>::from_account_id(account_id). Therefore, I wasn't sure whether we want do anything about it in the context of this PR - I'm open to any suggestion :)