@@ -20,7 +20,13 @@ use super::output::{extract_field, strip_ansi};
2020/// Tool-capable workload image used by the E2E harness.
2121///
2222/// Product defaults remain on the minimal NVIDIA Ubuntu image. Tests that
23- /// explicitly pass `--from` continue to exercise their requested image.
23+ /// explicitly pass `--from` or `--template` retain their requested workload.
24+ /// Docker setup builds this Noble-based fixture before running the tests.
25+ #[ cfg( feature = "e2e-docker" ) ]
26+ pub const E2E_WORKLOAD_IMAGE : & str = "openshell/e2e-python:dev" ;
27+
28+ /// Preserve the existing pullable fixture for non-Docker E2E lanes.
29+ #[ cfg( not( feature = "e2e-docker" ) ) ]
2430pub const E2E_WORKLOAD_IMAGE : & str = "ghcr.io/astral-sh/uv:0.12.17-python3.12-trixie-slim@sha256:9a59bb7206905ccaae4f7dab222fbac47c125a21e5fc16f43f427cd6c940ade3" ;
2531
2632/// Extract the sandbox name from CLI create output.
@@ -44,13 +50,17 @@ fn has_explicit_sandbox_name(args: &[&str]) -> bool {
4450 . any ( |arg| * arg == "--name" || arg. starts_with ( "--name=" ) )
4551}
4652
47- fn has_explicit_sandbox_image ( args : & [ & str ] ) -> bool {
48- args. iter ( )
49- . any ( |arg| * arg == "--from" || arg. starts_with ( "--from=" ) )
53+ fn has_explicit_sandbox_workload ( args : & [ & str ] ) -> bool {
54+ args. iter ( ) . take_while ( |arg| * * arg != "--" ) . any ( |arg| {
55+ * arg == "--from"
56+ || arg. starts_with ( "--from=" )
57+ || * arg == "--template"
58+ || arg. starts_with ( "--template=" )
59+ } )
5060}
5161
5262fn add_test_image_if_missing ( command : & mut tokio:: process:: Command , args : & [ & str ] ) {
53- if !has_explicit_sandbox_image ( args) {
63+ if !has_explicit_sandbox_workload ( args) {
5464 command. arg ( "--from" ) . arg ( E2E_WORKLOAD_IMAGE ) ;
5565 }
5666}
@@ -737,7 +747,7 @@ impl Drop for SandboxGuard {
737747
738748#[ cfg( test) ]
739749mod tests {
740- use super :: { has_explicit_sandbox_image , has_explicit_sandbox_name } ;
750+ use super :: { has_explicit_sandbox_name , has_explicit_sandbox_workload } ;
741751
742752 #[ test]
743753 fn detects_explicit_sandbox_names ( ) {
@@ -747,9 +757,17 @@ mod tests {
747757 }
748758
749759 #[ test]
750- fn detects_explicit_sandbox_images ( ) {
751- assert ! ( has_explicit_sandbox_image( & [ "--from" , "example:latest" ] ) ) ;
752- assert ! ( has_explicit_sandbox_image( & [ "--from=example:latest" ] ) ) ;
753- assert ! ( !has_explicit_sandbox_image( & [ "--policy" , "policy.yaml" ] ) ) ;
760+ fn detects_explicit_sandbox_workloads ( ) {
761+ assert ! ( has_explicit_sandbox_workload( & [ "--from" , "example:latest" ] ) ) ;
762+ assert ! ( has_explicit_sandbox_workload( & [ "--from=example:latest" ] ) ) ;
763+ assert ! ( has_explicit_sandbox_workload( & [ "--template" , "example" ] ) ) ;
764+ assert ! ( has_explicit_sandbox_workload( & [ "--template=example" ] ) ) ;
765+ assert ! ( !has_explicit_sandbox_workload( & [ "--policy" , "policy.yaml" ] ) ) ;
766+ assert ! ( !has_explicit_sandbox_workload( & [ "--" , "echo" , "--from=x" ] ) ) ;
767+ assert ! ( !has_explicit_sandbox_workload( & [
768+ "--" ,
769+ "echo" ,
770+ "--template=x"
771+ ] ) ) ;
754772 }
755773}
0 commit comments