-
Notifications
You must be signed in to change notification settings - Fork 619
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
RFC: introduce unified testing infrastructure for contract runtime #6922
Conversation
d7101fd
to
17f7c61
Compare
This is worthy of review now I think! I want to add some comments to the test_builder tommorow though. |
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.
Awesome stuff! Thanks for tackling this, I like the new approach so much better.
I also like how the exact gas change due to protocol_feature_fix_contract_loading_cost
is now checked in some tests that it previously wasn't. But see my comments in the code, I think as soon as we stabilise the feature, we lose some test coverage that I explicitly tried to have when I wrote tests for that feature.
test_builder().wasm(&bad_import_global("env")).method("hello").opaque_error().expect(expect![ | ||
[r#" | ||
VMOutcome: balance 4 storage_usage 12 return data None burnt gas 46500213 used gas 46500213 | ||
Err: ... |
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 wonder if we need something to specify different errors for different VMs. Or maybe we specifically don't care about what the error instance?
I'm just thinking that in the old version of the test, it was obvious from the code that there is a difference and AND if any of the errors changed, we would see it in the test.
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.
Yeah, I debated this. We could introduce multi-expect functionality here, the same way we do for protocl features.
However, I don't think we actually care. It's a property of our systems that errors are opaque. So we don't loose a lot if we erase everything except the fact that the error occured. Rather than supporting results between vm being different, I decided to double down on expressing that they should be sufficiently the same.
There are a couple of cases where the results are different and we care about that, that is hacked around by skipping two of the three runtimes (see test_nan_sign
).
Notable thing this doesn't do: the |
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 probably leave other reviewers time before merging but LGTM!
As @jakmeier already did it I have not reviewed all changes in-depth, but taking a look at a few of the resulting changes in tests, it looks much cleaner! |
I also looked at it briefly before, and I think interface wise this is good™. I haven't looked at the implementation details too deeply, but I'm willing to bet that its all reasonably good. |
Replaces imperative tests with declarative tests. The primary motivation here is better maintainability -- now that all tests go through the same test infrastructure which isolates internal API, it's possible to update tests en masse. Additionally, we gained ability to run the same test across different protocol versions, which should allow us to track not only the latest protocol, but all historical versions as well.
…6922) RFC solution for #6921 Vision: * remove `make_simple_call` family of functions completely in favor of unified `test_builde()` * use snapshot/expect testing rather than relying on `Error: Eq`. I'd love to use `insta` as that's what we are using elsewhere, but I don't think insta can do what I want here (packaging "snapshot" as a value), so I plugged my `expect_test`. * pull the `with_vm_kinds` loop inside
RFC solution for #6921
Vision:
make_simple_call
family of functions completely in favor of unifiedtest_builde()
Error: Eq
. I'd love to useinsta
as that's what we are using elsewhere, but I don't think insta can do what I want here (packaging "snapshot" as a value), so I plugged myexpect_test
.with_vm_kinds
loop inside