Proto/tests: Refactor begin_test and init_constants
What
Refactor of some test initialization functions to make constant setting more explicit, and will allow a greater degree of control over flags
Why
Part of the refactoring effort for AI/AS tests
How
Includes the constants definition in the scenario DSL, which makes it way less cumbersome on the test side. Caveats:
- Uses a module whose sole purpose is to abstract constant setting, it might be difficult or painful to maintain (?)
-
constantsare now completely defined within the scenarios, which means they cannot be extracted for high level use. In the existing tests, the only case wasconsensus_rights_delay, which was used to compute a certain number of cycles to wait until things happen. The current solution is to use the default value, but it might require a smarter solution (for instance, await_n_cyclesequivalent that can take a value computed from constants).
Manually testing the MR
dune exec src/proto_alpha/lib_protocol/test/integration/main.exe -- --match "test_scenario.*\.ml"
The tests should be exactly the same, so using --verbose &>> test.out before and after the patch should yield (more or less) the same results... it might take a bit, though
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Lucas Randazzo