mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-21 06:11:31 +08:00
test(docker): use automatic networking in e2e
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
#![cfg(feature = "e2e-docker")]
|
||||
|
||||
//! Run with both the default auto mode and forced bridge mode to exercise
|
||||
//! Exercise automatic networking selection using the workload runtime, along with
|
||||
//! authenticated gateway callbacks, interactive access, and supervisor restart.
|
||||
|
||||
use std::time::Duration;
|
||||
@@ -65,11 +65,7 @@ network_policies:
|
||||
.await
|
||||
.expect("create sandbox");
|
||||
let workload = inspect_role(&sandbox.name, "sandbox").await;
|
||||
let requested = std::env::var("OPENSHELL_E2E_DOCKER_SUPERVISOR_NETWORK_MODE")
|
||||
.unwrap_or_else(|_| "auto".into());
|
||||
let expected = if requested == "bridge"
|
||||
|| (requested == "auto" && workload["HostConfig"]["Runtime"] == "sysbox-runc")
|
||||
{
|
||||
let expected = if workload["HostConfig"]["Runtime"] == "sysbox-runc" {
|
||||
"bridge"
|
||||
} else {
|
||||
"host"
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
# SUPERVISOR_IMAGE=... (common test-wrapper override)
|
||||
# OPENSHELL_SUPERVISOR_IMAGE=... (existing compatibility override)
|
||||
# OPENSHELL_DOCKER_SUPERVISOR_IMAGE=... (Docker-specific override)
|
||||
# OPENSHELL_E2E_DOCKER_SUPERVISOR_NETWORK_MODE=auto|host|bridge
|
||||
# OPENSHELL_E2E_DOCKER_AUTOMATIC_ENDPOINT=1 omits the callback override.
|
||||
#
|
||||
# The default sandbox image uses a mutable tag. This wrapper refreshes it
|
||||
# before starting the gateway, while the Docker driver defaults to
|
||||
@@ -572,11 +570,6 @@ if connect_current_container_to_docker_network "${DOCKER_NETWORK_NAME}"; then
|
||||
SUPERVISOR_GATEWAY_HOST="${GATEWAY_HOST_ALIAS_IP}"
|
||||
else
|
||||
GATEWAY_HOST_ALIAS_IP=""
|
||||
if [ "${OPENSHELL_E2E_DOCKER_SUPERVISOR_NETWORK_MODE:-auto}" = "bridge" ]; then
|
||||
# This ephemeral test gateway deliberately admits bridge-side connections.
|
||||
GATEWAY_BIND_IP="0.0.0.0"
|
||||
SUPERVISOR_GATEWAY_HOST="host.docker.internal"
|
||||
fi
|
||||
fi
|
||||
|
||||
PKI_DIR="${WORKDIR}/pki"
|
||||
@@ -626,10 +619,10 @@ GATEWAY_CONFIG="${STATE_DIR}/gateway.toml"
|
||||
else
|
||||
printf 'allow_driver_config = true\n'
|
||||
printf 'sandbox_label = %s\n' "$(toml_string "${E2E_NAMESPACE}")"
|
||||
if [ "${OPENSHELL_E2E_DOCKER_AUTOMATIC_ENDPOINT:-0}" != "1" ]; then
|
||||
# Container jobs need their bridge address; host runs exercise discovery.
|
||||
if [ -n "${GATEWAY_HOST_ALIAS_IP}" ]; then
|
||||
printf 'grpc_endpoint = %s\n' "$(toml_string "${GATEWAY_ENDPOINT}")"
|
||||
fi
|
||||
printf 'supervisor_network_mode = %s\n' "$(toml_string "${OPENSHELL_E2E_DOCKER_SUPERVISOR_NETWORK_MODE:-auto}")"
|
||||
printf 'default_image = %s\n' "$(toml_string "${SANDBOX_IMAGE}")"
|
||||
printf 'image_pull_policy = %s\n' "$(toml_string "${SANDBOX_IMAGE_PULL_POLICY}")"
|
||||
printf 'enable_bind_mounts = true\n'
|
||||
@@ -643,10 +636,9 @@ GATEWAY_CONFIG="${STATE_DIR}/gateway.toml"
|
||||
if [ "${OPENSHELL_E2E_EXTERNAL_COMPUTE_DRIVER:-0}" = "1" ]; then
|
||||
{
|
||||
printf 'sandbox_label = %s\n' "$(toml_string "${E2E_NAMESPACE}")"
|
||||
if [ "${OPENSHELL_E2E_DOCKER_AUTOMATIC_ENDPOINT:-0}" != "1" ]; then
|
||||
if [ -n "${GATEWAY_HOST_ALIAS_IP}" ]; then
|
||||
printf 'grpc_endpoint = %s\n' "$(toml_string "${GATEWAY_ENDPOINT}")"
|
||||
fi
|
||||
printf 'supervisor_network_mode = %s\n' "$(toml_string "${OPENSHELL_E2E_DOCKER_SUPERVISOR_NETWORK_MODE:-auto}")"
|
||||
printf 'default_image = %s\n' "$(toml_string "${SANDBOX_IMAGE}")"
|
||||
printf 'image_pull_policy = %s\n' "$(toml_string "${SANDBOX_IMAGE_PULL_POLICY}")"
|
||||
printf 'guest_tls_ca = %s\n' "$(toml_string "${PKI_DIR}/ca.crt")"
|
||||
|
||||
+2
-5
@@ -302,12 +302,9 @@ depends = ["e2e:conformance:build"]
|
||||
run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-docker.sh"
|
||||
|
||||
["e2e:docker:supervisor-networking"]
|
||||
description = "Exercise Docker supervisor networking and restart in auto and bridge modes"
|
||||
description = "Exercise automatic Docker supervisor networking and restart"
|
||||
depends = ["e2e:workload:build"]
|
||||
run = [
|
||||
"e2e/with-docker-gateway.sh cargo test --manifest-path e2e/rust/Cargo.toml --features e2e-docker --test docker_supervisor_networking",
|
||||
"OPENSHELL_E2E_DOCKER_SUPERVISOR_NETWORK_MODE=bridge OPENSHELL_E2E_DOCKER_AUTOMATIC_ENDPOINT=1 e2e/with-docker-gateway.sh cargo test --manifest-path e2e/rust/Cargo.toml --features e2e-docker --test docker_supervisor_networking",
|
||||
]
|
||||
run = "e2e/with-docker-gateway.sh cargo test --manifest-path e2e/rust/Cargo.toml --features e2e-docker --test docker_supervisor_networking"
|
||||
|
||||
["e2e:mechanistic-existing-endpoint"]
|
||||
description = "Run #2821 existing inspected-endpoint auto-approval regression"
|
||||
|
||||
Reference in New Issue
Block a user