snarkOS
snarkOS copied to clipboard
[Feature] Add integration tests to the node REST API
🚀 Feature
Add http level tests of the aleo node REST API (as defined in Aleo CLI, SnarkOS and the beacon) to test the system end to end as a client without relying on internals (they could even be done in a separate language if necessary).
Motivation
- We need more thorough testing of the nodes and the ledger code.
- High-level API tests have the best cost-benefit in terms of their implementation effort and degree of confidence they provide
- Having these tests will force us to arrange the rest API, the related ledger code and the node operations in a more context-agnostic way (this is, if we make a SnarkOS node easy to run for tests, it will be easy to run for development and likely less coupled with specifics of the production environment)
- Having these types of tests in place will make adding endpoints easier and will reduce inertia to add tests along with the new code. Likewise it would be make it more natural to include API tests as we add new types of nodes.
- Having these types of tests in place will enable us to refactor the code and rearrange the projects with better confidence of not breaking the system.
Implementation
- We need a way to run a testing node. Ideally these should apply to all "types" of nodes (aleo cli node start, snarkos client, snarkos , as they currently expose different sets of endpoints. A baseline node with the defaults currently exposed by the rest crate could be a good first setp.
- We need a set of rust unit tests or an external script that exercises different test cases for each of the exposed endpoints, and verify effects on the node.
This could get more sophisticated (e.g. mocking state) but it's best to start with something simple and start to benefit from it right away.
Are you willing to open a pull request?
The Entropy1729 team is willing to work on this.