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.

80 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. * `tail`: tails (follows) node logs until cancelled.
  23. ## Tests
  24. 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.
  25. ### Running Manual Tests
  26. 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.:
  27. ```sh
  28. ./build/runner -f networks/ci.toml start
  29. E2E_MANIFEST=networks/ci.toml go test -v ./tests/...
  30. ```
  31. Optionally, `E2E_NODE` specifies the name of a single testnet node to test.
  32. These environment variables can also be specified in `tests/e2e_test.go` to run tests from an editor or IDE:
  33. ```go
  34. func init() {
  35. // This can be used to manually specify a testnet manifest and/or node to
  36. // run tests against. The testnet must have been started by the runner first.
  37. os.Setenv("E2E_MANIFEST", "networks/ci.toml")
  38. os.Setenv("E2E_NODE", "validator01")
  39. }
  40. ```
  41. ### Debugging Failures
  42. 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`.
  43. ## Enabling IPv6
  44. 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):
  45. ```json
  46. {
  47. "ipv6": true,
  48. "fixed-cidr-v6": "2001:db8:1::/64"
  49. }
  50. ```