Skip to main content

Sandbox Lifecycle

Test file: rossoctl/tests/e2e/openshell/test_04_sandbox_lifecycle.py Tests: 7 | Pass: 7 | Skip: 0 (Kind, fresh cluster)

What This Tests

Validates Sandbox CR (agents.x-k8s.io/v1alpha1) CRUD operations and status observability via Kubernetes API. This is the A2A-first equivalent of the OpenShell proposal's "openshell term shows sandbox status" requirement.

Architecture Under Test

Test Matrix

TestSandbox CRGatewayAgent Deployments
List sandboxes
Create sandbox
Delete sandbox
Gateway processes sandbox
Gateway status queryable
Agent deployments status queryable
Agent pods status queryable
Sandbox CR status queryable
Gateway logs accessible

Test Details

test_list_sandboxes

  • What: List Sandbox CRs — should succeed even if none exist
  • Asserts: kubectl returncode == 0, "items" in JSON response
  • Debug points: kubectl returncode, stderr
  • Agent coverage: N/A (tests CRD availability)

test_create_sandbox

  • What: Create a Sandbox CR and verify the gateway picks it up
  • Asserts:
    • kubectl apply succeeds
    • Sandbox CR exists after creation
    • Sandbox name matches expected
  • Debug points: kubectl returncode, stderr, sandbox name
  • Agent coverage: N/A (tests gateway reactivity)
  • Cleanup: Deletes sandbox after test

test_delete_sandbox

  • What: Create then delete a sandbox CR — self-contained
  • Asserts: kubectl delete succeeds
  • Debug points: kubectl returncode, stderr
  • Agent coverage: N/A (tests CR deletion)
  • Cleanup: Self-cleaning (deletes own sandbox)

test_gateway_processes_sandbox

  • What: Verify the gateway logs show it processed a sandbox event
  • Asserts: Gateway logs contain "Listing sandboxes" or "sandbox"
  • Debug points: Gateway log contents
  • Agent coverage: Gateway (openshell-system namespace)

test_gateway_status_queryable

  • What: Gateway StatefulSet status is queryable with phase and readiness
  • Asserts: readyReplicas >= spec.replicas
  • Debug points: Gateway StatefulSet status
  • Agent coverage: Gateway (openshell-system namespace)

test_agent_deployments_status_queryable

  • What: Each agent deployment exposes replicas, readyReplicas, conditions
  • Asserts:
    • Deployment status has replica counts OR conditions
    • (relaxed assertion to allow rollout-in-progress states)
  • Debug points: Deployment name, status fields
  • Agent coverage: ALL custom A2A agents (team1 namespace)

test_agent_pods_status_queryable

  • What: Each agent pod exposes phase, containerStatuses, and resource usage
  • Asserts:
    • Pod phase == "Running"
    • containerStatuses present
    • restartCount exists
  • Debug points: Pod name, phase, container status
  • Agent coverage: ALL custom A2A agents (team1 namespace)

test_sandbox_cr_status_queryable

  • What: Sandbox CRs expose status fields when created
  • Asserts:
    • kubectl get sandboxes succeeds
    • Response has "items" field
  • Debug points: kubectl returncode, stderr
  • Agent coverage: N/A (tests CRD schema)

test_gateway_logs_accessible

  • What: Gateway logs are accessible for debugging and audit
  • Asserts:
    • kubectl logs succeeds
    • Logs not empty
  • Debug points: kubectl returncode, log length
  • Agent coverage: Gateway (openshell-system namespace)

Status Observability (vs OpenShell Proposal)

The OpenShell proposal requires:

"openshell term shows sandbox status"

In Rossoctl's A2A-first model, sandbox status is observed via:

Proposal RequirementRossoctl A2A EquivalentHow Tested
openshell term shows statuskubectl get pod/deploy/sandbox -o jsontest_*_status_queryable
Terminal session activeAgent A2A endpoint respondstest_02_a2a_connectivity
Session reconnectPVC-backed session restoretest_06_conversation_resume

The Rossoctl UI PodStatusPanel queries the same Kubernetes API these tests validate.

Sandbox CR Schema

apiVersion: agents.x-k8s.io/v1alpha1
kind: Sandbox
metadata:
name: test-sandbox-poc
namespace: team1
spec:
podTemplate: # Standard K8s PodSpec
spec:
containers:
- name: sandbox
image: ghcr.io/nvidia/openshell-community/sandboxes/base:latest
command: ["sleep", "300"]

Future Expansion

Agent TypeWhen AddedWhat's Needed
openshell_claudePhase 2Test Claude Code sandbox image creation
openshell_opencodePhase 2Test OpenCode sandbox image creation
Supervisor integrationPhase 2Test supervisor init container injection

Common Failure Modes

SymptomCauseFix
Sandbox CRD not foundOpenShell not installedDeploy OpenShell gateway + CRDs
Gateway not processingGateway pod not runningCheck gateway StatefulSet status
Pod not createdInvalid podTemplateValidate spec against K8s PodSpec schema
Logs emptyGateway just startedWait 10s for gateway initialization