Files
tbd/integration-tests/README.md
2026-09-19 05:42:17 -09:00

2.8 KiB

Integration Tests

Dockerized integration tests for the vibe server.

Quick Start

Run the full test suite (builds the app, starts it, runs tests):

cd integration-tests
docker-compose up --abort-on-container-exit

Manual Run (app already running)

If your vibe app is running locally on port 3000:

cd integration-tests
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:

cd integration-tests
bb integration_test.bb http://localhost:3000

Or from the repo root, via the bb.edn task:

bb 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 <ms> 5000 Delay between runs in watch mode

Example — watch a local server every 2 seconds:

bb integration-test 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 for the unit tests, the integration tests, and both combined. From the repo root:

Task What it does Output
bb unit-coverage Runs test/ under Cloverage target/coverage/unit/
bb integration-coverage Runs the integration suite against a Cloverage-instrumented vibe-app container target/coverage/integration/
bb coverage-report Merges the two lcov.info files, prints a per-file table target/coverage/merged/
bb 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. bb integration-coverage stops the container (docker compose stop) so the report gets written, then copies it out with docker compose cp. Plain bb integration-test / bb test are unchanged and run the uninstrumented app.