22# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33# SPDX-License-Identifier: Apache-2.0
44
5- # Run the Rust e2e smoke test against a standalone gateway running the
5+ # Run a Rust e2e test against a standalone gateway running the
66# bundled Docker compute driver.
77#
88# Unlike the Kubernetes driver (which deploys a k3s cluster) or the VM
2020# 4. Starts openshell-gateway with --drivers=docker, binding to a
2121# random free host port.
2222# 5. Installs the client cert into the CLI gateway config dir and
23- # runs the Rust smoke test.
23+ # runs the selected Rust e2e test.
2424# 6. Tears the gateway process down on exit.
2525#
26- # Usage: mise run e2e:docker
26+ # Usage:
27+ # mise run e2e:docker
28+ # mise run e2e:docker:gpu
2729
2830set -euo pipefail
2931
@@ -35,6 +37,8 @@ STATE_DIR=""
3537GATEWAY_CONFIG_DIR=" "
3638GATEWAY_PID=" "
3739GATEWAY_LOG=" ${WORKDIR} /gateway.log"
40+ E2E_TEST=" ${OPENSHELL_E2E_DOCKER_TEST:- smoke} "
41+ GPU_MODE=" ${OPENSHELL_E2E_DOCKER_GPU:- 0} "
3842# Unique sandbox namespace for this test run. Set just before the gateway
3943# is started so cleanup can filter Docker containers strictly to ones
4044# this run created, even when other OpenShell sandboxes are present on
@@ -119,6 +123,17 @@ if ! command -v openssl >/dev/null 2>&1; then
119123 echo " ERROR: openssl is required to generate ephemeral PKI" >&2
120124 exit 2
121125fi
126+ if [ " ${GPU_MODE} " = " 1" ]; then
127+ DOCKER_CDI_SPEC_DIRS=" $( docker info --format ' {{json .CDISpecDirs}}' 2> /dev/null || true) "
128+ if [ -z " ${DOCKER_CDI_SPEC_DIRS} " ] \
129+ || [ " ${DOCKER_CDI_SPEC_DIRS} " = " null" ] \
130+ || [ " ${DOCKER_CDI_SPEC_DIRS} " = " []" ] \
131+ || [ " ${DOCKER_CDI_SPEC_DIRS} " = " <no value>" ]; then
132+ echo " ERROR: e2e:docker:gpu requires Docker CDI support." >&2
133+ echo " Generate CDI specs and restart Docker, then verify docker info reports CDISpecDirs." >&2
134+ exit 2
135+ fi
136+ fi
122137
123138normalize_arch () {
124139 case " $1 " in
@@ -186,8 +201,10 @@ chmod +x "${SUPERVISOR_BIN}"
186201# in the image. Use the community sandbox base image (also what real
187202# deployments default to). Callers can override with
188203# OPENSHELL_E2E_DOCKER_SANDBOX_IMAGE if they have a smaller local image
189- # with the required 'sandbox' user.
190- SANDBOX_IMAGE=" ${OPENSHELL_E2E_DOCKER_SANDBOX_IMAGE:- ghcr.io/ nvidia/ openshell-community/ sandboxes/ base: latest} "
204+ # with the required 'sandbox' user. CDI injects the NVIDIA userspace
205+ # stack at runtime, so the GPU lane uses the same base image.
206+ DEFAULT_SANDBOX_IMAGE=" ghcr.io/nvidia/openshell-community/sandboxes/base:latest"
207+ SANDBOX_IMAGE=" ${OPENSHELL_E2E_DOCKER_SANDBOX_IMAGE:- ${DEFAULT_SANDBOX_IMAGE} } "
191208if ! docker image inspect " ${SANDBOX_IMAGE} " > /dev/null 2>&1 ; then
192209 echo " Pulling ${SANDBOX_IMAGE} ..."
193210 docker pull " ${SANDBOX_IMAGE} "
@@ -313,8 +330,8 @@ if [ "${elapsed}" -ge "${timeout}" ]; then
313330 exit 1
314331fi
315332
316- # ── Run the smoke test ─── ────────────────────────────────────────────
317- echo " Running e2e smoke test (gateway: ${OPENSHELL_GATEWAY} , endpoint: ${CLI_GATEWAY_ENDPOINT} )..."
318- cargo test --manifest-path e2e/rust/Cargo.toml --features e2e --test smoke -- --nocapture
333+ # ── Run the selected test ────────────────────────────────────────────
334+ echo " Running e2e ${E2E_TEST} test (gateway: ${OPENSHELL_GATEWAY} , endpoint: ${CLI_GATEWAY_ENDPOINT} )..."
335+ cargo test --manifest-path e2e/rust/Cargo.toml --features e2e --test " ${E2E_TEST} " -- --nocapture
319336
320- echo " Smoke test passed."
337+ echo " ${E2E_TEST} test passed."
0 commit comments