open-web3-stack / polkadot-ecosystem-tests

Polkadot Ecosystem Tests powered by Chopsticks
8 stars 6 forks source link
polkadot

Polkadot Ecosystem Tests

Polkadot Ecosystem Tests powered by Chopsticks.

Run and update tests

Notes

Develop new tests

Add a new chain

Chain configurations are defined in packages/networks/src/chains. Use existing chains as examples. Make sure to update index.ts as well.

Add XCM tests between two chains

The XCM tests are defined in packages/kusama/src and packages/polkadot/src for Kusama chains and Polkadot chains respectively. Add a new file named of <chain1>.<chain2>.test.ts for tests between those two chains. Use existing files as examples.

Add new kind of XCM tests

The XCM tests are defined in packages/shared/src/xcm. They are implemented in such a way that they are network agnostic and can be reused across different chains. The tests should also be tolerant to minor changes regarding onchain envoronment. For example, they should not be impacted by a small change in transaction fees, and should use .redact to round the numbers or remove fields that are constantly changing.

For network specific tests that cannot be reused, just add them as normal tests.

Environment Variables

Environment variables can be set in .env file. The following variables are supported:

Known Good Block Numbers

Known good block numbers are stored in KNOWN_GOOD_BLOCK_NUMBERS.env. Those block numbers are used by default when running tests unless they are overriden by environment variables.

The Update Known Good Block Numbers workflow will automatically update the known good block numbers periodically.

Use yarn update-known-good to update the known good block numbers manually.

Use yarn update-env to fetch the latest block numbers for all chains and save them to .env file. Note this change is ignored by git. However, it can be useful to ensure the tests are not flaky due to block number changes.

Use Update Snapshots workflow if there are some new changes breaks the tests. It will update known good block numbers, update snapshots, and open an PR. Please review the update snapshots to ensure it is expected. In case of changes due to onchain fees, we will want to adjust precision in the tests to prevent flakiness in the future.