Skip to content

Commit 25055a1

Browse files
fix: pull container image in TestNewExecutorWithAuto before execution
On Linux CI, container runtime (podman/docker) is available but the golang:1.23-alpine image is not pre-pulled. The test now checks if a container backend was selected and pulls the image if needed, or skips if the pull fails.
1 parent 4afb281 commit 25055a1

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎pkg/sandbox/container_test.go‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,19 @@ func TestNewExecutorWithAuto(t *testing.T) {
329329
backend := exec.Backend()
330330
t.Logf("Auto-selected backend: %s", backend)
331331

332+
// If container backend was selected, ensure image exists
333+
if backend == BackendPodman || backend == BackendDocker {
334+
if containerExec, ok := exec.(*ContainerExecutor); ok {
335+
if !containerExec.ImageExists() {
336+
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
337+
defer cancel()
338+
if err := containerExec.PullImage(ctx); err != nil {
339+
t.Skipf("Container backend selected but failed to pull image: %v", err)
340+
}
341+
}
342+
}
343+
}
344+
332345
// Execute basic code
333346
result, err := exec.Execute(context.Background(), `fmt.Println("Hello from auto backend!")`)
334347
if err != nil {

0 commit comments

Comments
 (0)