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.

96 lines
3.1 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
  5. ./build/runner -f networks/ci.toml
  6. ```
  7. This creates and runs a testnet named `ci` under `networks/ci/` (determined by the manifest filename).
  8. ## Testnet Manifests
  9. 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).
  10. ## Random Testnet Generation
  11. Random (but deterministic) combinations of testnets can be generated with `generator`:
  12. ```sh
  13. ./build/generator -d networks/generated/
  14. # Split networks into 8 groups (by filename)
  15. ./build/generator -g 8 -d networks/generated/
  16. ```
  17. Multiple testnets can be run with the `run-multiple.sh` script:
  18. ```sh
  19. ./run-multiple.sh networks/generated/gen-group3-*.toml
  20. ```
  21. ## Test Stages
  22. The test runner has the following stages, which can also be executed explicitly by running `./build/runner -f <manifest> <stage>`:
  23. * `setup`: generates configuration files.
  24. * `start`: starts Docker containers.
  25. * `load`: generates a transaction load against the testnet nodes.
  26. * `perturb`: runs any requested perturbations (e.g. node restarts or network disconnects).
  27. * `wait`: waits for a few blocks to be produced, and for all nodes to catch up to it.
  28. * `test`: runs test cases in `tests/` against all nodes in a running testnet.
  29. * `stop`: stops Docker containers.
  30. * `cleanup`: removes configuration files and Docker containers/networks.
  31. * `logs`: outputs all node logs.
  32. * `tail`: tails (follows) node logs until cancelled.
  33. ## Tests
  34. 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.
  35. ### Running Manual Tests
  36. 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.:
  37. ```sh
  38. ./build/runner -f networks/ci.toml start
  39. E2E_MANIFEST=networks/ci.toml go test -v ./tests/...
  40. ```
  41. Optionally, `E2E_NODE` specifies the name of a single testnet node to test.
  42. These environment variables can also be specified in `tests/e2e_test.go` to run tests from an editor or IDE:
  43. ```go
  44. func init() {
  45. // This can be used to manually specify a testnet manifest and/or node to
  46. // run tests against. The testnet must have been started by the runner first.
  47. os.Setenv("E2E_MANIFEST", "networks/ci.toml")
  48. os.Setenv("E2E_NODE", "validator01")
  49. }
  50. ```
  51. ### Debugging Failures
  52. 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`.
  53. ## Enabling IPv6
  54. 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):
  55. ```json
  56. {
  57. "ipv6": true,
  58. "fixed-cidr-v6": "2001:db8:1::/64"
  59. }
  60. ```