|
| 1 | +# Integration test |
| 2 | + |
| 3 | +This integration test exercises the real project-creation path of |
| 4 | +`openstack-project-manager` against a **live Keystone** instead of mocks. |
| 5 | +Keystone is deployed locally on a [kind](https://kind.sigs.k8s.io/) cluster via |
| 6 | +[forge](https://github.com/c5c3/forge) (its ControlPlane Quick Start), and the |
| 7 | +test then creates one project using the admin account and verifies it through |
| 8 | +the OpenStack SDK. |
| 9 | + |
| 10 | +It is deliberately a scaffold: one happy-path test. The unit suite under |
| 11 | +`test/unit/` keeps everything mocked; this harness is the first thing that |
| 12 | +talks to a real `openstack.connect()` / `keystone.projects.update()` path. |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | + |
| 16 | +- A Docker-capable host with the Docker daemon running. |
| 17 | +- Outbound network access (to clone forge, pull operator images, and resolve |
| 18 | + `keystone.127-0-0-1.nip.io` via [nip.io](https://nip.io/) to `127.0.0.1`). |
| 19 | +- For local runs, `openstacksdk` and `tox` must be importable in the active |
| 20 | + environment (the CI job installs them into a throwaway venv). `kind` and |
| 21 | + `kubectl` are installed by forge's own `make install-test-deps` into |
| 22 | + `~/.local/bin`; the scripts prepend that directory to `PATH`. |
| 23 | + |
| 24 | +## Usage |
| 25 | + |
| 26 | +```bash |
| 27 | +# Full cycle: provision kind + Keystone, create a project, verify it, and tear |
| 28 | +# the cluster down on every exit path (including failure). |
| 29 | +make integration |
| 30 | + |
| 31 | +# Deploy Keystone and leave the cluster running for local debugging. |
| 32 | +make integration-up |
| 33 | + |
| 34 | +# Tear down the cluster left running by `make integration-up`. |
| 35 | +make integration-down |
| 36 | +``` |
| 37 | + |
| 38 | +`make integration` only deletes a cluster it created itself. If a kind cluster |
| 39 | +named `forge` already exists (for example one you started with |
| 40 | +`make integration-up`), it is reused and left in place on exit. |
| 41 | + |
| 42 | +## Environment overrides |
| 43 | + |
| 44 | +| Variable | Default | Purpose | |
| 45 | +|---|---|---| |
| 46 | +| `FORGE_REF` | `main` | forge git ref to check out (tip is fetched on every run; not pinned). | |
| 47 | +| `FORGE_DIR` | `${TMPDIR:-/tmp}/opm-forge` | Where forge is cloned. | |
| 48 | +| `CLUSTER_NAME` | `forge` | kind cluster name. | |
| 49 | +| `KIND_HOST_PORT` | `8443` | Host port the Envoy Gateway (and Keystone) is exposed on. | |
| 50 | +| `NAMESPACE` | `openstack` | Namespace the ControlPlane CR is applied to. | |
| 51 | +| `OS_CLIENT_CONFIG_FILE` | `test/integration/clouds.yaml` | Generated clouds.yaml path. | |
| 52 | +| `KEEP_PROJECT` | `0` | Set to `1` to keep the created project after `verify.py` (the cluster is torn down regardless). | |
| 53 | + |
| 54 | +## What is asserted |
| 55 | + |
| 56 | +After `tox -e create` creates the project as admin, `verify.py` connects with |
| 57 | +the OpenStack SDK and asserts that: |
| 58 | + |
| 59 | +- the `default` domain resolves, |
| 60 | +- the `opm-integration-test` project exists in it, and |
| 61 | +- the per-project group of the same name exists. |
| 62 | + |
| 63 | +`verify.py` exits non-zero on any failed assertion. It is a standalone script, |
| 64 | +not a `unittest`/`pytest` test, and is not named `test_*.py`, so the fast unit |
| 65 | +gate (`tox -e test`) never collects it. |
| 66 | + |
| 67 | +## Credentials |
| 68 | + |
| 69 | +No real credentials are committed. `deploy_keystone.sh` reads the admin |
| 70 | +password from the operator-projected |
| 71 | +`controlplane-keystone-admin-credentials` Secret and writes an ephemeral |
| 72 | +`clouds.yaml` (gitignored) with `verify: false`, because the Envoy Gateway |
| 73 | +serves a self-signed cert. `run.sh` removes the generated `clouds.yaml` on |
| 74 | +exit. |
0 commit comments