|
| 1 | +# E2E Tests — Run Book |
| 2 | + |
| 3 | +All tests are `#[ignore]` and require live infrastructure. Always pass `--ignored --nocapture --test-threads=1`. |
| 4 | + |
| 5 | +## `.env` support |
| 6 | + |
| 7 | +Harness auto-loads `e2e-tests/.env` if present (shell-exported vars still win). Copy the template: |
| 8 | + |
| 9 | +```bash |
| 10 | +cp e2e-tests/.env.example e2e-tests/.env |
| 11 | +$EDITOR e2e-tests/.env |
| 12 | +``` |
| 13 | + |
| 14 | +`.env` is gitignored + dockerignored. |
| 15 | + |
| 16 | +## Compile only |
| 17 | + |
| 18 | +```bash |
| 19 | +cargo test -p e2e-tests --no-run |
| 20 | +``` |
| 21 | + |
| 22 | +## Suite 1 — `builder.rs` (pre-installed cluster) |
| 23 | + |
| 24 | +Requires an already-bootstrapped cluster. Env vars: |
| 25 | + |
| 26 | +```bash |
| 27 | +export BUILDER_HOST=<ssh-addr-of-builder-host> |
| 28 | +export COOLD_ONLY_HOST=<ssh-addr-of-coold-only-host> |
| 29 | +export BUILDER_MGMT=<wg0-ip-of-builder-host> |
| 30 | +export COOLD_ONLY_MGMT=<wg0-ip-of-coold-only-host> |
| 31 | +export CENTRAL_HOST=<ssh-addr-of-central> |
| 32 | +export SSH_KEY=~/.ssh/<key> |
| 33 | +# optional: |
| 34 | +export SSH_USER=root |
| 35 | +``` |
| 36 | + |
| 37 | +### Run all in suite |
| 38 | + |
| 39 | +```bash |
| 40 | +cargo test -p e2e-tests --test builder -- --ignored --nocapture --test-threads=1 |
| 41 | +``` |
| 42 | + |
| 43 | +### Individual tests |
| 44 | + |
| 45 | +```bash |
| 46 | +cargo test -p e2e-tests --test builder pin_to_builder_host -- --ignored --nocapture |
| 47 | +cargo test -p e2e-tests --test builder pin_to_coold_only_host_returns_503 -- --ignored --nocapture |
| 48 | +cargo test -p e2e-tests --test builder unknown_host_id_returns_503 -- --ignored --nocapture |
| 49 | +cargo test -p e2e-tests --test builder load_balance_picks_builder_host -- --ignored --nocapture |
| 50 | +cargo test -p e2e-tests --test builder build_cancel_emits_stage_cancel -- --ignored --nocapture |
| 51 | +cargo test -p e2e-tests --test builder coold_restart_adopts_in_flight_build -- --ignored --nocapture |
| 52 | +``` |
| 53 | + |
| 54 | +## Suite 2 — `install.rs` (Hetzner-provisioned) |
| 55 | + |
| 56 | +Provisions VMs via Hetzner Cloud API, runs `coolify init apply`, asserts networking, destroys VMs on drop. Env vars: |
| 57 | + |
| 58 | +```bash |
| 59 | +export HETZNER_TOKEN=<project-scoped-token> |
| 60 | +export HETZNER_PROJECT=<label-value-for-cleanup-filter> |
| 61 | +export SSH_KEY=~/.ssh/<key> # privkey path; .pub derived or read |
| 62 | +export COOLIFY_BIN=$(which coolify) # local Go CLI path (default "coolify") |
| 63 | +# optional: |
| 64 | +export HETZNER_LOCATION=nbg1 |
| 65 | +export HETZNER_IMAGE=ubuntu-24.04 |
| 66 | +export HETZNER_SERVER_TYPE=cx23 |
| 67 | +``` |
| 68 | + |
| 69 | +### Both in parallel (each test provisions its own VMs) |
| 70 | + |
| 71 | +Name filter `install_` selects install_single_host + install_two_hosts and skips `cleanup_leaked_hetzner` (which would otherwise race the sweeper against live VMs). |
| 72 | + |
| 73 | +```bash |
| 74 | +cargo test -p e2e-tests --test install install_ -- --ignored --nocapture |
| 75 | +``` |
| 76 | + |
| 77 | +### Single-host only |
| 78 | + |
| 79 | +```bash |
| 80 | +cargo test -p e2e-tests --test install install_single_host -- --ignored --nocapture |
| 81 | +``` |
| 82 | + |
| 83 | +### Two-host only |
| 84 | + |
| 85 | +```bash |
| 86 | +cargo test -p e2e-tests --test install install_two_hosts -- --ignored --nocapture |
| 87 | +``` |
| 88 | + |
| 89 | +### Leaked-resource sweeper |
| 90 | + |
| 91 | +Deletes every Hetzner server + ssh_key labeled `coolify-e2e=1` in the project. Use after a ctrl-c / crash left VMs behind. Extra `CONFIRM_SWEEP=1` gate — without it the test is a no-op, so it's safe to leave in the suite. |
| 92 | + |
| 93 | +```bash |
| 94 | +CONFIRM_SWEEP=1 cargo test -p e2e-tests --test install cleanup_leaked_hetzner -- --ignored --nocapture |
| 95 | +``` |
| 96 | + |
| 97 | +## Manual spot-checks (post-install failure triage) |
| 98 | + |
| 99 | +```bash |
| 100 | +ssh root@<ip> wg show wg0 |
| 101 | +ssh root@<ip> iptables -S COOLIFY-INTRA |
| 102 | +ssh root@<ip> nft list table bridge coolify_bridge |
| 103 | +ssh root@<ipA> podman exec e2e-a ping -c1 <ipB> |
| 104 | +``` |
0 commit comments