You've already forked ansible-netbox-inventory
docs: end-to-end testing and v2 token documentation
This commit is contained in:
19
README.md
19
README.md
@@ -66,7 +66,7 @@ inventory:
|
|||||||
| Key | Default | Meaning |
|
| Key | Default | Meaning |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `netbox.url` | — (required) | Base URL of the NetBox instance |
|
| `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.verify_ssl` | `true` | Verify the TLS certificate |
|
||||||
| `netbox.timeout` | `30` | Per-request timeout in seconds |
|
| `netbox.timeout` | `30` | Per-request timeout in seconds |
|
||||||
| `inventory.source` | `ip-addresses` | `ip-addresses` or `virtual-machines` |
|
| `inventory.source` | `ip-addresses` | `ip-addresses` or `virtual-machines` |
|
||||||
@@ -148,6 +148,23 @@ make lint # ruff checks
|
|||||||
make format # ruff formatter
|
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
|
## Known limitations
|
||||||
|
|
||||||
- One filter option per run, filters do not combine; run the script twice with
|
- One filter option per run, filters do not combine; run the script twice with
|
||||||
|
|||||||
Reference in New Issue
Block a user