Open akoptelov opened 1 year ago
I'll try to set this up using Github Actions as much as possible.
Here are some ideas/thoughts on the testing for messages (also applicable to other components).
Problems to be targeted by the tests (note that this is for both native and wasm32):
Here are some additional requirements:
There are some issues here:
#[wasm_bindgen_test]
macro, and a special test runner is used. At least we can have some common function that performs the test operation and then asserts its results, and then have two simple wrappers for it.std::io
/std::fs
stuff in wasm32 runtime -- this means that we cannot read input data that easily as we do for native tests (e,g, test data stored in files). For now I'm using include_str!
and include_bytes!
macro as a workaround. Probably we can extend that approach to multiple files (like let data: &[(&str, &[u8])] = include_bytes_from_dir!("test-data/*.bin")
)criterion
, when a test should be able to read the current baseline and possibly write the updated one to the fs.easybench-wasm
crate (crates.io), but it misses baselining support, AFAIK, and it is mostly aimed at micro-benchmarking, and not suitable for measuring long-running operations (e.g. tens/hundreds of milliseconds). So for that we might need another (homegrown?) solution.See the allocations and performance benchmarks for messages (gossip messages and RPC catchup sequence). Native tests: https://github.com/name-placeholder/mina-p2p-messages-rs/actions/runs/3346769732/jobs/5543986463 Wasm tests (with the perf one failing because of flakiness): https://github.com/name-placeholder/mina-p2p-messages-rs/actions/runs/3346769732/jobs/5543986587
Performance tests lib should be updated a bit, now the regression detection is incorrect (based only on mean value), and stdev value is not displayed.
Definition of Done: working CI pipelines and reports (see below)