Skip to content

Commit 53d1497

Browse files
docs(e2e): add a testkit suite quickstart
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
1 parent abcda69 commit 53d1497

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

‎TESTING.md‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,65 @@ tests/tmachine/ # QEMU test machines, Ansible playbooks, and the Session
2222
tests/runner/ # openshell-test-runner: runs a test family in a tmachine environment
2323
```
2424

25+
## E2E suite quickstart
26+
27+
The suites in `tests/suites/` run against a real OpenShell gateway. Tests use
28+
`#[testkit::test]` to get a gateway client, run CLI commands, and clean up
29+
sandboxes. Testkit doesn't install the gateway or its dependencies.
30+
31+
- **Conformance** checks public behavior that must work on every driver.
32+
- **Feature suites** check behavior that needs a service or gateway setting,
33+
such as Keycloak. Each feature is a package in the `features` workspace.
34+
- **Driver suites** check behavior specific to one compute driver. Each driver
35+
suite is its own workspace, such as `drivers/kubernetes`.
36+
37+
See [Where a new test goes](#where-a-new-test-goes) before adding coverage.
38+
39+
### Run against a local gateway
40+
41+
With Docker available, `mise run e2e:testkit` starts a gateway and runs
42+
conformance. To use a gateway you've already set up, select it with
43+
`OPENSHELL_GATEWAY` (or use the active gateway) and run the suite with Cargo.
44+
For example, against a Kubernetes gateway:
45+
46+
```shell
47+
cargo test --locked --manifest-path tests/suites/drivers/kubernetes/Cargo.toml
48+
```
49+
50+
For a feature with extra dependencies, you must also provide its settings and
51+
fixtures. The [testkit README](tests/testkit/README.md) explains how tests
52+
find the gateway and CLI.
53+
54+
### Run in the same environment as CI
55+
56+
**tmachine** boots a VM, sets up the engine and any add-ons, and installs
57+
OpenShell. **`openshell-test-runner`** runs your selected suite in that VM
58+
using nextest. A [CI matrix row](.github/workflows/e2e-suites.yml) pairs
59+
the environment and installer with the family and, for features, the package.
60+
61+
On a host with virtualization support, build the installer inputs once with
62+
`nix run .#build-artifacts`. Then run a feature or driver suite:
63+
64+
```shell
65+
nix run .#openshell-test-runner -- run \
66+
--environment ubuntu-docker-rootful-keycloak --installer deb \
67+
--family features --package keycloak-provider-refresh
68+
69+
nix run .#openshell-test-runner -- run \
70+
--environment ubuntu-k3s --installer k3s \
71+
--family drivers/kubernetes --gateway tmachine
72+
```
73+
74+
Use `--installer k3s-ha` for the Kubernetes HA row. For a single test, add
75+
`--filter 'test(kubernetes_sandbox_runs_a_command)'`. Results and logs go to
76+
`artifacts/test-results/` by default. See
77+
[Running suites in a tmachine environment](#running-suites-in-a-tmachine-environment-testsrunner)
78+
for prerequisites and options.
79+
80+
The **VM driver** doesn't run nested inside tmachine. Run `mise run e2e:vm`
81+
on a supported VM host; it starts the VM-backed gateway and runs conformance
82+
and the VM driver suite.
83+
2584
## Rust Tests
2685

2786
Unit tests live inline with `#[cfg(test)] mod tests` blocks. Integration tests

0 commit comments

Comments
 (0)