From 9dbcdfad667eb4adb49f7fe72bf3fff4fb9b471c Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Tue, 25 Aug 2026 13:47:35 +0200 Subject: [PATCH] docs: end-to-end testing and v2 token documentation --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 649cd7d..22cfd6f 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ inventory: | Key | Default | Meaning | |---|---|---| | `netbox.url` | — (required) | Base URL of the NetBox instance | -| `netbox.token` | — (required) | API token, sent as `Authorization: Token ...` | +| `netbox.token` | — (required) | API token, both legacy tokens (sent as `Authorization: Token ...`) and NetBox 4.5+ v2 tokens (`nbt_...`, sent as `Authorization: Bearer ...`) work | | `netbox.verify_ssl` | `true` | Verify the TLS certificate | | `netbox.timeout` | `30` | Per-request timeout in seconds | | `inventory.source` | `ip-addresses` | `ip-addresses` or `virtual-machines` | @@ -148,6 +148,23 @@ make lint # ruff checks make format # ruff formatter ``` +End-to-end tests run against a real NetBox in docker, modelled on the +production deployment but exposed straight on `127.0.0.1:8800` with throwaway +credentials (see `e2e/env.example`) and no persistence: + +```sh +make e2e-up # start the stack, first boot takes a few minutes +make test-e2e # seed via the API and test every source/filter scenario +make e2e-down # tear down and delete all data +``` + +Seeding creates a read-only `ansible-inventory` user with a self-provisioned +v2 token, two tenants, two sites, two clusters, a VRF, three virtual machines +and a handful of IP addresses, then the tests run the actual inventory script +as an executable against every filter, every error path and the Ansible +`--list` / `--host` protocol. Seeding is idempotent, `make test-e2e` can be +re-run at will. + ## Known limitations - One filter option per run, filters do not combine; run the script twice with