To run unit test of the blockchain node:
cargo test
(WIP: run pRuntime unit tests)
A source-based code coverage can be generated by grcov. We have prepared a convenient script to run it for our pallets:
./scripts/coverage-pallets.sh
The script generates a HTML report. It's known to always generate some false negative.
Phala has an end-to-end (E2E) test suite that runs all the core components (node, relayer, and pRuntime). To run the E2E test, please prepare first:
-
Build the blockchain and relayer (pherrry):
cargo build --release
-
Build pRuntime:
cd standalone/pruntimes SGX_MODE=SW make
-
Initialize the E2E test project (Make sure you have node.js >=14 and yarn installed):
cd e2e yarn yarn build:proto
The preparation is only required once. If you changed the code, you just need to rebuild the parts you have changed. Now run the E2E test:
yarn test