Skip to content

Commit a257f6a

Browse files
committed
test(e2e): add portable CLI conformance baseline
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 1c8c930 commit a257f6a

11 files changed

Lines changed: 1266 additions & 86 deletions

File tree

TESTING.md

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,16 @@ lifecycle management, output parsing, and cleanup.
148148
Suites:
149149

150150
- Common suite (`--features e2e`) - driver-neutral CLI behavior, sandbox lifecycle, sync, port forwarding, policy, and provider tests.
151-
- Docker suite (`--features e2e-docker`) - common suite plus Docker-only coverage such as Dockerfile image builds, Docker preflight checks, and managed Docker gateway start.
151+
- CLI conformance (`--features e2e-cli-conformance`) - the portable deployment
152+
smoke scenario plus focused tests for its reusable command runner.
153+
- Driver suites (`--features e2e-docker`, `e2e-podman`, `e2e-kubernetes`, or
154+
`e2e-vm`) - CLI conformance plus the common and driver-specific coverage for
155+
the selected deployment.
156+
- Docker suite (`--features e2e-docker`) - includes Docker-only coverage such as Dockerfile image builds, Docker preflight checks, and managed Docker gateway start.
152157
- Docker GPU suite (`--features e2e-docker-gpu`) - Docker suite plus GPU sandbox smoke coverage.
153158
- VM suite (`--features e2e-vm`) - runs e2e tests on a VM.
154159
- Kubernetes credential-driver suite (`--features e2e-kubernetes-credential-drivers`) - targeted Kubernetes Secrets and Vault provider credential storage coverage.
155160

156-
VM overlay and TLS-key permission assertions run only in the VM suite; the
157-
driver-neutral smoke test does not include them.
158-
159161
GPU device-selection tests compare OpenShell sandboxes against a plain Docker or
160162
Podman container that requests `--device nvidia.com/gpu=all`. The probe image
161163
defaults to the image used by the `gateway` stage in
@@ -172,6 +174,42 @@ Run the Docker-backed Rust CLI e2e suite:
172174
mise run e2e:rust
173175
```
174176

177+
Run the minimal portable CLI conformance profile against the gateway selected
178+
in your OpenShell CLI configuration:
179+
180+
```shell
181+
mise run e2e:cli-conformance
182+
```
183+
184+
The gateway must already be installed, reachable, and selected before the task
185+
starts. The task does not provision a gateway or select a compute driver. Set
186+
`OPENSHELL_BIN` to test a prebuilt CLI; otherwise, the task builds the CLI from
187+
the current checkout.
188+
189+
The phase-1 scenario verifies the complete CLI-to-gateway-to-driver path without
190+
depending on how the gateway was installed or which driver is configured. It
191+
requires machine-readable gRPC status, creates a uniquely named detached
192+
sandbox with `--from base`, verifies the sandbox is `Ready` by finding its
193+
unique name in paginated JSON list output, executes `echo` with a run-specific
194+
marker, deletes the sandbox, and verifies that its name no longer appears.
195+
Driver suites enable the same profile
196+
instead of maintaining a separate smoke implementation. Sandbox lifecycle,
197+
label matrices, VM overlay, and TLS-key permission assertions remain regular
198+
E2E coverage.
199+
200+
Each invocation prints a ten-character run ID before creating resources.
201+
Conformance sandboxes use names such as `ct-<run-id>-01`. The runner tracks the
202+
exact name and uses it for cleanup; phase 1 does not add ownership labels.
203+
204+
The runner deletes owned resources after both success and failure. If the test
205+
process is interrupted before cleanup, locate leftovers without touching
206+
unrelated gateway state:
207+
208+
```shell
209+
openshell sandbox list --output json
210+
openshell sandbox delete <sandbox-name>
211+
```
212+
175213
Run the Podman-backed Rust CLI e2e suite:
176214

177215
```shell

e2e/rust/Cargo.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ license = "Apache-2.0"
1616
publish = false
1717

1818
[features]
19-
e2e = []
19+
# Selects the minimal portable CLI conformance profile.
20+
e2e-cli-conformance = []
21+
# Selects the common E2E suite, including the CLI conformance baseline.
22+
e2e = ["e2e-cli-conformance"]
2023
# Selects tests that rely on `host.openshell.internal` (the sandbox's stable
2124
# alias to the host running test fixtures). docker, podman, and vm wire the
2225
# alias unconditionally; the kube driver only does so when the chart's
@@ -41,6 +44,11 @@ name = "oidc_pkce"
4144
path = "tests/oidc_pkce.rs"
4245
required-features = ["e2e-oidc-pkce"]
4346

47+
[[test]]
48+
name = "smoke"
49+
path = "tests/smoke.rs"
50+
required-features = ["e2e-cli-conformance"]
51+
4452
[[test]]
4553
name = "vm_overlay"
4654
path = "tests/vm_overlay.rs"

e2e/rust/e2e-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -euo pipefail
1010

1111
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
1212
E2E_TEST="${OPENSHELL_E2E_DOCKER_TEST:-smoke}"
13-
E2E_FEATURES="${OPENSHELL_E2E_DOCKER_FEATURES:-e2e,e2e-docker}"
13+
E2E_FEATURES="${OPENSHELL_E2E_DOCKER_FEATURES:-e2e-docker}"
1414
DEFAULT_WORKLOAD_MANIFEST="${ROOT}/e2e/gpu/images/.build/workloads.yaml"
1515

1616
if [ "${E2E_TEST}" = "gpu" ] && [ -z "${OPENSHELL_E2E_WORKLOAD_MANIFEST:-}" ] && [ ! -f "${DEFAULT_WORKLOAD_MANIFEST}" ]; then

e2e/rust/e2e-kubernetes.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ E2E_FEATURES="${OPENSHELL_E2E_KUBERNETES_FEATURES:-e2e,e2e-host-gateway,e2e-kube
2626
# local CLI needs to be built when CI has not supplied a prebuilt one.
2727
if [ -z "${OPENSHELL_BIN:-}" ]; then
2828
cargo build -p openshell-cli
29+
export OPENSHELL_BIN="${ROOT}/target/debug/openshell"
2930
fi
3031

3132
test_filter=()

0 commit comments

Comments
 (0)