mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 11:38:59 +02:00
✨ tests: add binary e2e suite (Traefik binary + Go mock LAPI), run it in CI
Add a second e2e suite that runs Traefik as a downloaded binary with the plugin loaded from source, and replaces Crowdsec with a small stdlib-only Go LAPI mock driven via /admin endpoints. No Docker, no real Crowdsec. The mock lives in its own nested Go module (tests/e2e/mock/mocklapi) so it stays out of the plugin module's build, lint, test and vendor. This suite validates the plugin's own behaviour (live/none/stream modes, caching, trusted-IP bypass, ban/captcha rendering). Crowdsec and AppSec correctness are out of scope on purpose — they are validated upstream by the maintainer — so the AppSec scenario is intentionally absent and the README says so to avoid misfiled issues. CI now runs this suite only (`make e2e_mock`), since it needs neither Docker nor a real Crowdsec. The Docker suite (tests/e2e/scenarios) is kept for local debugging (`make e2e`). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+15
-5
@@ -1,5 +1,16 @@
|
||||
# End-to-end test suite
|
||||
|
||||
There are two suites:
|
||||
|
||||
- **`scenarios/` (this one)** — real Traefik + Crowdsec **Docker** containers.
|
||||
High fidelity, kept for **local debugging**. Run with `make e2e`.
|
||||
- **[`mock/`](mock/README.md)** — Traefik **binary** + a **mock LAPI**, no
|
||||
Docker. This is what **CI runs** (`make e2e_mock`). It validates the
|
||||
plugin's own behaviour; Crowdsec / AppSec correctness is out of scope there
|
||||
(that is the upstream maintainer's responsibility).
|
||||
|
||||
The rest of this document covers the Docker suite.
|
||||
|
||||
These tests spin up real Traefik + Crowdsec containers and exercise the
|
||||
plugin in the same conditions Traefik uses in production: loaded from a
|
||||
local path, no module download, no mocking.
|
||||
@@ -45,8 +56,7 @@ images are downloaded only once for the whole suite.
|
||||
|
||||
## CI
|
||||
|
||||
`.github/workflows/e2e.yml` runs the whole suite in a single job
|
||||
(`make -k e2e`) on every PR and push to `main`. `-k` lets the remaining
|
||||
scenarios run after a failure so the logs cover all of them, while make
|
||||
still exits non-zero if any scenario failed. On failure, the per-scenario
|
||||
logs (`/tmp/e2e-*.log`) are uploaded as an artifact named `e2e-logs`.
|
||||
This Docker suite is **not** run in CI — it is meant for local debugging.
|
||||
`.github/workflows/e2e.yml` runs the [`mock/`](mock/README.md) suite
|
||||
(`make -k e2e_mock`) instead, which needs neither Docker nor a real Crowdsec.
|
||||
Run this suite locally with `make e2e` (or `make e2e_<scenario>`).
|
||||
|
||||
Reference in New Issue
Block a user