-
Notifications
You must be signed in to change notification settings - Fork 154
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
test(core): e2e test cases core maciState/Poll #910
Conversation
✅ Deploy Preview for maci-typedoc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
3c0891c
to
907ae03
Compare
processMessage()
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.
Thanks for this, it can be very useful to ensure MACI works correctly, though I have some thoughts:
Currently these are gearing towards being e2e tests for the MaciState/Poll classes, which is definitely useful, though I wonder if it would be best to focus on unit testing MaciState/Poll as we already have e2e/integration tests that touch on MACI from 0 to end (though what we have now as e2e and integration tests are not the best, and in general they do not "test" much as failures could be for a variety of reasons - we have an issue open to track this #869).
If you strongly feel to keep these as it is, then I would ask you to please rename everything appropriately, e.g. move to a e2e folder inside core tests, rename to not be processMessages specific (as you are relying on tally votes too).
Otherwise, we now have an open PR which refactors the processMessage
related functions, making processMessage
public and parameterised with custom errors. This way it is now much easier to do unit testing and actually test that the different results are because of the different conditions (which is what is missing in this PR as well as our e2e/integration tests suite and that we need to fix). - Also the TestHarness class can possibly be adapted to work on our integration tests
|
||
const messageBatchSize = 25; | ||
|
||
class TestHarness { |
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 nice and can be very useful, but please document it and move it to an util file!
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 specifically designed for testing purposes and does not require exporting
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.
Besides this point, we can consider designing a high-level module similar to this, something like:
class MACIHighLevel {
init();
vote();
tally();
}
However, this is beyond the scope of the current PR
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.
The TestHarness class is still without any comments/documentation
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.
so we can't re-use it for other tests? 😔
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.
actually, TestHarness has been liberated for the good of all tests in 687bc92
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.
🙏 thanks for that and for documenting it
These are e2e tests at the As a side note, these tests are black-box in nature, which is why they rely on the results of |
Thanks for the feedback @ctrlc03 , I've changed file name and modified it to check for a specific throw condition. Please have another look |
dfc3b8b
to
04759de
Compare
Hey @ctrlc03, I need write access to push some updates. I've fixed the ESLint errors on the branch |
Sorry for taking this long to get back to you! Would you be happy for us to complete this: we would fix conflicts and push a commit to fix eslint errors. Otherwise you could open a PR from a fork? up to you and how you prefer to get this done 🙂 |
Check out the latest fixes here, and you can go from there. I would like to avoid opening redundant PR and keep things tidy |
Updated, thanks for your contribution :) lmk if it looks good to you |
f46b9e3
to
87d9076
Compare
thanks, the change looks good overall. just left one small comment |
4f21e6d
to
43629a5
Compare
This PR adds end-to-end test cases of the off-chain state machine, focusing on sanity checks.
Related to #792