|
| 1 | +# User-written E2E tests |
| 2 | + |
| 3 | +This directory is reserved for **your** E2E tests against a live |
| 4 | +Proxmox VE server. Anything you put here: |
| 5 | + |
| 6 | +* **Survives regeneration.** The generator's orphan-removal step is |
| 7 | + driven by `.openapi-generator/FILES` — files outside that manifest |
| 8 | + (including this whole directory) are never touched by `sdk-sync`. |
| 9 | +* **Survives the workflow wipe.** `sdk-bootstrap` only touches the |
| 10 | + workflow files it manages (`ci.yml`, `publish.yml`). User-added |
| 11 | + workflows like `.github/workflows/e2e.yml` are preserved verbatim. |
| 12 | + |
| 13 | +The auto-generated SDK code lives outside this directory; treat |
| 14 | +everything under `tests/e2e` as your own. |
| 15 | + |
| 16 | +## Quickstart |
| 17 | + |
| 18 | +1. Add fixtures, helpers, and tests under `tests/e2e/`. |
| 19 | +2. (Optional) Add `.github/workflows/e2e.yml` to run them in CI against |
| 20 | + a Proxmox VE test instance — the sync pipeline preserves |
| 21 | + any workflow file whose name isn't in the managed allowlist. |
| 22 | +3. The generated `ci.yml` runs the SDK's own build + unit tests; wire |
| 23 | + your E2E suite into a separate workflow so it can use its own |
| 24 | + secrets / runners / schedule. |
| 25 | + |
| 26 | +## Conventions per language |
| 27 | + |
| 28 | +| Language | User-test path | Runner | |
| 29 | +|---|---|---| |
| 30 | +| TypeScript | `tests/e2e/*.test.ts` | `vitest run tests/e2e` | |
| 31 | +| Python | `tests/e2e/test_*.py` | `pytest tests/e2e` | |
| 32 | +| Go | `tests/e2e/*_test.go` (package `e2e_test`) | `go test ./tests/e2e/...` | |
| 33 | +| Rust | `tests/e2e/*.rs` | `cargo test --test '*'` | |
| 34 | +| PHP | `tests/E2E/*Test.php` | `vendor/bin/phpunit tests/E2E` | |
| 35 | +| Kotlin | `src/test/kotlin/e2e/*Test.kt` | `./gradlew test --tests 'e2e.*'` | |
| 36 | + |
| 37 | +> The Kotlin generator's post-process step deletes |
| 38 | +> `src/test/kotlin/**/apis/*.kt` and `src/test/kotlin/**/models/*.kt` |
| 39 | +> (openapi-generator's stub tests). Keep your tests **outside** those |
| 40 | +> two subpaths — the `e2e/` directory recommended above is the |
| 41 | +> intended location and is never touched by the pipeline. |
| 42 | +
|
| 43 | +## Authenticating against a real server |
| 44 | + |
| 45 | +Use the API-token format documented in the SDK's main README: |
| 46 | + |
| 47 | +* Perl family (PVE, PMG): `<PREFIX>APIToken=USER@REALM!TOKENID=UUID` |
| 48 | +* Rust family (PBS, PDM): `<PREFIX>APIToken=USER@REALM!TOKENID:UUID` |
| 49 | + |
| 50 | +Set the secret via env var so tests stay portable: |
| 51 | + |
| 52 | +```sh |
| 53 | +PVE_HOST=https://pve.example.com:8006 |
| 54 | +PVE_TOKEN='PVEAPIToken=root@pam!auto=<your-uuid>' |
| 55 | +PVE_INSECURE_TLS=1 # only when targeting a self-signed dev server |
| 56 | +``` |
0 commit comments