# Integration Tests Dockerized integration tests for the vibe server. ## Quick Start Run the full test suite (builds the app, starts it, runs tests): ```bash cd integration-test docker-compose up --abort-on-container-exit ``` ## Manual Run (app already running) If your vibe app is running locally on port 3000: ```bash cd integration-test docker run --rm -v "$(pwd)/integration_test.bb:/integration_test.bb:ro" babashka/babashka:latest bb /integration_test.bb http://host.docker.internal:3000 ``` Or run directly on a host with babashka installed: ```bash cd integration-test bb integration_test.bb http://localhost:3000 ``` Or from the repo root, via the script: ```bash script/integration-test ``` ### Options | Flag | Default | Description | |------|---------|--------------| | `[base-url]` (positional) | `http://localhost:3000` | Server to test against | | `--watch` | off | Re-run the suite on a timer instead of exiting after one run | | `--interval ` | `5000` | Delay between runs in watch mode | Example — watch a local server every 2 seconds: ```bash bb integration-test/integration_test.bb http://localhost:3000 --watch --interval 2000 ``` ## What's Tested | # | Test | Checks | |---|------|--------| | 1 | `GET /` returns 200 | HTTP status code | | 2 | `Content-Type` header | `text/plain` | | 3 | Response body | Contains expected Clojure/Ring content | | 4 | Not HTML | Confirms plain text response | | 5 | `HEAD /` works | HTTP 200 | ## Line Coverage Line coverage is measured with [Cloverage](https://github.com/cloverage/cloverage) for the unit tests, the integration tests, and both combined. From the repo root: | Task | What it does | Output | |------|--------------|--------| | `script/unit-coverage` | Runs `test/` under Cloverage | `target/coverage/unit/` | | `script/integration-coverage` | Runs the integration suite against a Cloverage-instrumented `vibe-app` container | `target/coverage/integration/` | | `script/coverage-report` | Merges the two `lcov.info` files, prints a per-file table | `target/coverage/merged/` | | `script/coverage` | All three, in order (the full suite with a joint report) | all of the above | Each directory contains an `index.html` (open it in a browser) and an `lcov.info`. In the merged report a line counts as covered if either suite hit it; the HTML shows per-line hit counts per suite (`u:` unit, `i:` integration). How the integration numbers are collected: `docker-compose.coverage.yml` starts the app via `vibe.integration.coverage`, which lets Cloverage instrument `src/` and then serves real traffic until it receives SIGTERM. `script/integration-coverage` stops the container (`docker compose stop`) so the report gets written, then copies it out with `docker compose cp`. Plain `script/integration-test` / `script/test` are unchanged and run the uninstrumented app.