mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-12-06 04:56:33 +08:00
docs(e2e): direct new tests to testkit (#5909)
* test(e2e): add Kubernetes driver testkit suite Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * test(e2e): run a VM driver testkit suite on the host lane Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * ci(e2e): freeze new legacy Rust E2E tests Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * docs(e2e): add a testkit suite quickstart Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * chore(e2e): align driver suites with main Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * docs(e2e): retire the legacy Rust suite through contributor guidance Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> --------- Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
This commit is contained in:
@@ -171,6 +171,7 @@ ocsf_emit!(event);
|
||||
## Sandbox Infra Changes
|
||||
|
||||
- If you change sandbox infrastructure, ensure the relevant sandbox e2e path succeeds.
|
||||
- For new E2E tests, see [Where a new test goes](TESTING.md#where-a-new-test-goes).
|
||||
|
||||
## Network Sockets
|
||||
|
||||
|
||||
+69
@@ -22,6 +22,60 @@ tests/tmachine/ # QEMU test machines, Ansible playbooks, and the Session
|
||||
tests/runner/ # openshell-test-runner: runs a test family in a tmachine environment
|
||||
```
|
||||
|
||||
## E2E suite quickstart
|
||||
|
||||
The suites in `tests/suites/` run against a real OpenShell gateway. Tests use
|
||||
`#[testkit::test]` to get a gateway client, run CLI commands, and clean up
|
||||
sandboxes. Testkit doesn't install the gateway or its dependencies.
|
||||
|
||||
- **Conformance** checks public behavior that must work on every driver.
|
||||
Tests [share a gateway](#what-a-conformance-test-may-assert) and run with
|
||||
four nextest workers in CI, except on the VM host lane.
|
||||
- **Feature suites** check behavior that needs a service or gateway setting,
|
||||
such as Keycloak. Each feature is a package in the `features` workspace.
|
||||
- **Driver suites** check behavior specific to one compute driver. Each driver
|
||||
suite is its own workspace, such as `drivers/podman`.
|
||||
|
||||
See [Where a new test goes](#where-a-new-test-goes) before adding coverage.
|
||||
|
||||
### Run against a local gateway
|
||||
|
||||
With Docker available, `mise run e2e:testkit` starts a gateway and runs
|
||||
conformance. To use a gateway you've already set up, select it with
|
||||
`OPENSHELL_GATEWAY` (or use the active gateway) and run conformance with nextest:
|
||||
|
||||
```shell
|
||||
cargo nextest run --locked --manifest-path tests/suites/conformance/Cargo.toml --test-threads 1
|
||||
```
|
||||
|
||||
For a feature with extra dependencies, you must also provide its settings and
|
||||
fixtures. The [testkit README](tests/testkit/README.md) explains how tests
|
||||
find the gateway and CLI.
|
||||
|
||||
### Run in the same environment as CI
|
||||
|
||||
**tmachine** boots a VM, sets up the engine and any add-ons, and installs
|
||||
OpenShell. **`openshell-test-runner`** runs your selected suite in that VM
|
||||
using nextest. A [CI matrix row](.github/workflows/e2e-suites.yml) pairs
|
||||
the environment and installer with the family and, for features, the package.
|
||||
|
||||
On a host with virtualization support, build the installer inputs once with
|
||||
`nix run .#build-artifacts`. Then run a feature or driver suite:
|
||||
|
||||
```shell
|
||||
nix run .#openshell-test-runner -- run \
|
||||
--environment ubuntu-docker-rootful-keycloak --installer deb \
|
||||
--family features --package keycloak-provider-refresh
|
||||
|
||||
nix run .#openshell-test-runner -- run \
|
||||
--environment fedora-podman-rootful-userns-default --installer rpm \
|
||||
--family drivers/podman
|
||||
```
|
||||
|
||||
Results and logs go to `artifacts/test-results/` by default. See
|
||||
[Running suites in a tmachine environment](#running-suites-in-a-tmachine-environment-testsrunner)
|
||||
for prerequisites and options.
|
||||
|
||||
## Rust Tests
|
||||
|
||||
Unit tests live inline with `#[cfg(test)] mod tests` blocks. Integration tests
|
||||
@@ -472,8 +526,23 @@ def test_multiply(sandbox):
|
||||
| `sandbox_client` | session | gRPC client connected to the active gateway |
|
||||
| `sandbox` | function | Factory returning a `Sandbox` context manager |
|
||||
|
||||
### Where a new test goes
|
||||
|
||||
| If the test needs… | Put it here |
|
||||
|---|---|
|
||||
| A public contract that applies to every driver | `tests/suites/conformance` |
|
||||
| A service or fixed gateway setting | `tests/suites/features/<name>`; add a tmachine add-on if the setup is missing (see [Adding a feature suite](#adding-a-feature-suite)) |
|
||||
| Driver-specific behavior | `tests/suites/drivers/<driver>`; use the Podman suite as a model. |
|
||||
| State that must survive a restart or upgrade | [Continuity suites](#continuity-suites-testssuitescontinuity) if the runner can apply the disruption between test phases. |
|
||||
|
||||
If your test needs an environment or suite that doesn't exist yet, ask a
|
||||
maintainer where to add it.
|
||||
|
||||
### Rust CLI E2E (`e2e/rust/`)
|
||||
|
||||
Do not add new tests to `e2e/rust/`. You can edit or remove existing tests.
|
||||
See [Where a new test goes](#where-a-new-test-goes) for alternatives.
|
||||
|
||||
Rust-based e2e tests that exercise the `openshell` CLI binary as a subprocess.
|
||||
They live in the `openshell-e2e` crate and use a shared harness for sandbox
|
||||
lifecycle management, output parsing, and cleanup.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# Legacy Rust E2E tests
|
||||
|
||||
Do not add new tests to `e2e/rust/`, including in existing files. This suite
|
||||
is being retired. You can update or remove existing tests.
|
||||
|
||||
Add new E2E coverage with testkit under `tests/suites/`. See
|
||||
[Where a new test goes](../../TESTING.md#where-a-new-test-goes) and the
|
||||
[E2E suite quickstart](../../TESTING.md#e2e-suite-quickstart).
|
||||
Reference in New Issue
Block a user