celo-org / celo-monorepo

Official repository for core projects comprising the Celo platform
https://celo.org
Apache License 2.0
697 stars 370 forks source link

Refactor "test-sol" directory structure into unit, e2e, and integration tests #11022

Closed arthurgousset closed 3 months ago

arthurgousset commented 4 months ago

Follow-on task from this PR:

I decided to keep that PR small, but in a subsequent PR, I'd like to refactor the test-sol/ directory structure like:

test-sol/unit/
test-sol/e2e/
test-sol/integration/

That way we could run tests on CI with a command structure like:

# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"

Nice to haves

  1. Consider refactoring this step on CI:

    1. have better file name
    2. run a single anvil devchain to use for integration and e2e tests to save time

    https://github.com/celo-org/celo-monorepo/blob/bfbad45621bd5d5ac5cb35de1b005ef126c6b996/.github/workflows/protocol_tests.yml#L102-L104

  2. Move anvil scripts to scripts/anvil/ instead of migrations_sol/ (we already have scripts/truffle/ and scripts/bash/)

  3. Organise CI workflow into unit, integration, and e2e tests

    https://github.com/celo-org/celo-monorepo/blob/bfbad45621bd5d5ac5cb35de1b005ef126c6b996/.github/workflows/protocol_tests.yml#L64-L65

    - name: Run tests common
    + name: Run unit tests common