You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.7 KiB

  1. # End-to-End Tests
  2. Spins up and tests Tendermint networks in Docker Compose based on a testnet manifest. To run the CI testnet:
  3. ```sh
  4. make docker
  5. make runner
  6. ./build/runner -f networks/ci.toml
  7. ```
  8. This creates and runs a testnet named `ci` under `networks/ci/` (determined by the manifest filename).
  9. ## Testnet Manifests
  10. Testnets are specified as TOML manifests. For an example see [`networks/ci.toml`](networks/ci.toml), and for documentation see [`pkg/manifest.go`](pkg/manifest.go).
  11. ## Test Stages
  12. The test runner has the following stages, which can also be executed explicitly by running `./build/runner -f <manifest> <stage>`:
  13. * `setup`: generates configuration files.
  14. * `start`: starts Docker containers.
  15. * `load`: generates a transaction load against the testnet nodes.
  16. * `perturb`: runs any requested perturbations (e.g. node restarts or network disconnects).
  17. * `wait`: waits for a few blocks to be produced, and for all nodes to catch up to it.
  18. * `test`: runs test cases in `tests/` against all nodes in a running testnet.
  19. * `stop`: stops Docker containers.
  20. * `cleanup`: removes configuration files and Docker containers/networks.
  21. * `logs`: outputs all node logs.
  22. ## Tests
  23. Test cases are written as normal Go tests in `tests/`. They use a `testNode()` helper which executes each test as a parallel subtest for each node in the network.
  24. ### Running Manual Tests
  25. To run tests manually, set the `E2E_MANIFEST` environment variable to the path of the testnet manifest (e.g. `networks/ci.toml`) and run them as normal, e.g.:
  26. ```sh
  27. ./build/runner -f networks/ci.toml start
  28. E2E_MANIFEST=networks/ci.toml go test -v ./tests/...
  29. ```
  30. Optionally, `E2E_NODE` specifies the name of a single testnet node to test.
  31. These environment variables can also be specified in `tests/e2e_test.go` to run tests from an editor or IDE:
  32. ```go
  33. func init() {
  34. // This can be used to manually specify a testnet manifest and/or node to
  35. // run tests against. The testnet must have been started by the runner first.
  36. os.Setenv("E2E_MANIFEST", "networks/ci.toml")
  37. os.Setenv("E2E_NODE", "validator01")
  38. }
  39. ```
  40. ### Debugging Failures
  41. If a command or test fails, the runner simply exits with an error message and non-zero status code. The testnet is left running with data in the testnet directory, and can be inspected with e.g. `docker ps`, `docker logs`, or `./build/runner -f <manifest> logs` or `tail`. To shut down and remove the testnet, run `./build/runner -f <manifest> cleanup`.
  42. ## Enabling IPv6
  43. Docker does not enable IPv6 by default. To do so, enter the following in `daemon.json` (or in the Docker for Mac UI under Preferences → Docker Engine):
  44. ```json
  45. {
  46. "ipv6": true,
  47. "fixed-cidr-v6": "2001:db8:1::/64"
  48. }
  49. ```