| 1 | # Integration tests |
| 2 | |
| 3 | These tests run verse against a real Prosody server. Docker Compose builds one |
| 4 | image on top of `prosodyim/prosody:trunk`, which supplies the server, verse's |
| 5 | Lua dependencies and the `prosody.*` libraries, then runs the server and the |
| 6 | test client as two services. The image builds verse.lua both ways, the default |
| 7 | build that uses the installed Prosody's libraries and the `--standalone` build |
| 8 | that embeds them, and the suite runs against each. |
| 9 | |
| 10 | cd tests |
| 11 | docker compose up --build --abort-on-container-exit --exit-code-from tests |
| 12 | |
| 13 | Run a subset by naming test files (without `.lua`), or a single flavour by |
| 14 | running `tests/run.lua` directly (the default `LUA_PATH` selects the default |
| 15 | build; point it at `/verse/build/standalone` for the other): |
| 16 | |
| 17 | docker compose run --rm tests sh tests/run.sh roster muc |
| 18 | docker compose run --rm tests lua5.4 tests/run.lua roster |
| 19 | |
| 20 | Set `VERSE_TEST_DEBUG=1` on the `tests` service to see verse's debug log. |
| 21 | |
| 22 | Test files live in `tests/integration/` and return a list of |
| 23 | `{ "description", function (t) ... end }` pairs. Each test creates clients |
| 24 | with `t.client(user, on_ready, opts)`, wraps callbacks that contain assertions |
| 25 | in `t.cb(...)`, and calls `t.done()` when finished. The server config is in |
| 26 | `prosody/prosody.cfg.lua`; the accounts `alice` and `bob` (password `secret`) |
| 27 | are created at startup. |