-
Notifications
You must be signed in to change notification settings - Fork 293
chore: Testing Scenario DSL #2011
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
Conversation
48e226e to
1b1a6c1
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2011 +/- ##
==========================================
- Coverage 67.95% 67.73% -0.23%
==========================================
Files 213 214 +1
Lines 28972 28742 -230
==========================================
- Hits 19688 19468 -220
+ Misses 9284 9274 -10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
daira
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.
utACK with minor suggestions.
nuttycom
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.
Blocking on opportunity to review - I will try to get to this today.
| /// - Attempts to construct a request to spend the whole balance to an external address in the | ||
| /// same pool. | ||
| /// - succeds at doing so | ||
| // TODO(schell): as far as I can tell this function is unused in our test suite |
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.
That's probably a bug. It should be called in the same pattern as the other functions in this module. This is quite error-prone (it's easy to forget to call a test) and I'd like to find a better way of doing it.
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.
If we don't have any uses of this, we should add one and see whether it passes.
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 added a test for this function on main and it does not pass. I'm guessing that's why it's currently unused?
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.
utACK with a non-blocking comment. If that comment is not resolved then please file an issue about it. This does not override @nuttycom's request to wait for his review.
refactored TestState::generate_next_block in terms of TestState::generate_next_block_multi TestDsl::add_notes_to now takes a generic iterator of notes
nuttycom
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.
utACK with naming nits. Also, I would prefer that the DSF -> Dsf capitalization change be reverted because it makes the diff here noisier than it needs to be.
| if note_config.value > zip317::MARGINAL_FEE { | ||
| // Don't include uneconomic (dust) notes in the expected | ||
| // total, as the balance won't include them. | ||
| expected_total = (expected_total + note_config.value).unwrap(); | ||
| } |
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.
This is a weird place to hardcode this behavior. Maybe the dust threshold should at least be part of the builder, but when we add the ability to consume dust notes in grace inputs then even that would likely break.
Maybe this is okay for now, but it seems like something that will be annoying to track down from test failures if we change how balance calculation is done.
This would be fine if this reflected the documented semantics of balance calculation, but I'm not sure that the balance calculation APIs currently document such a contract.
| /// - Attempts to construct a request to spend the whole balance to an external address in the | ||
| /// same pool. | ||
| /// - succeds at doing so | ||
| // TODO(schell): as far as I can tell this function is unused in our test suite |
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.
If we don't have any uses of this, we should add one and see whether it passes.
…renamed TestDsl::with_standard_sapling_account to TestDsl::with_sapling_birthday_account
5270ee1 to
3645510
Compare
nuttycom
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.
utACK a3dfd9e, nice delta!
This PR introduces a wrapper over
TestBuilderandTestStatethat provides a scenario-driven API with which to create tests that are easily grokked.So far the test API covers the "add funds" portion of a test scenario.
Existing tests were refactored in terms of this DSL where appropriate.