@@ -10,6 +10,7 @@ import (
1010 "reflect"
1111 "testing"
1212
13+ "github.com/go-vela/types/constants"
1314 "github.com/go-vela/types/pipeline"
1415 "github.com/go-vela/worker/internal/image"
1516 velav1alpha1 "github.com/go-vela/worker/runtime/kubernetes/apis/vela/v1alpha1"
@@ -337,7 +338,7 @@ func TestKubernetes_SetupContainer(t *testing.T) {
337338 wantFromTemplate : nil ,
338339 },
339340 {
340- name : "step-echo" ,
341+ name : "step-echo-pull always " ,
341342 failure : false ,
342343 container : & pipeline.Container {
343344 ID : "step_github_octocat_1_echo" ,
@@ -348,7 +349,79 @@ func TestKubernetes_SetupContainer(t *testing.T) {
348349 Image : "alpine:latest" ,
349350 Name : "echo" ,
350351 Number : 2 ,
351- Pull : "always" ,
352+ Pull : constants .PullAlways ,
353+ },
354+ opts : nil ,
355+ wantPrivileged : false ,
356+ wantFromTemplate : nil ,
357+ },
358+ {
359+ name : "step-echo-pull never" ,
360+ failure : false ,
361+ container : & pipeline.Container {
362+ ID : "step_github_octocat_1_echo" ,
363+ Commands : []string {"echo" , "hello" },
364+ Directory : "/vela/src/github.com/octocat/helloworld" ,
365+ Environment : map [string ]string {"FOO" : "bar" },
366+ Entrypoint : []string {"/bin/sh" , "-c" },
367+ Image : "alpine:latest" ,
368+ Name : "echo" ,
369+ Number : 2 ,
370+ Pull : constants .PullNever ,
371+ },
372+ opts : nil ,
373+ wantPrivileged : false ,
374+ wantFromTemplate : nil ,
375+ },
376+ {
377+ name : "step-echo-pull on start" ,
378+ failure : false ,
379+ container : & pipeline.Container {
380+ ID : "step_github_octocat_1_echo" ,
381+ Commands : []string {"echo" , "hello" },
382+ Directory : "/vela/src/github.com/octocat/helloworld" ,
383+ Environment : map [string ]string {"FOO" : "bar" },
384+ Entrypoint : []string {"/bin/sh" , "-c" },
385+ Image : "alpine:latest" ,
386+ Name : "echo" ,
387+ Number : 2 ,
388+ Pull : constants .PullOnStart ,
389+ },
390+ opts : nil ,
391+ wantPrivileged : false ,
392+ wantFromTemplate : nil ,
393+ },
394+ {
395+ name : "step-echo-pull not present" ,
396+ failure : false ,
397+ container : & pipeline.Container {
398+ ID : "step_github_octocat_1_echo" ,
399+ Commands : []string {"echo" , "hello" },
400+ Directory : "/vela/src/github.com/octocat/helloworld" ,
401+ Environment : map [string ]string {"FOO" : "bar" },
402+ Entrypoint : []string {"/bin/sh" , "-c" },
403+ Image : "alpine:latest" ,
404+ Name : "echo" ,
405+ Number : 2 ,
406+ Pull : constants .PullNotPresent ,
407+ },
408+ opts : nil ,
409+ wantPrivileged : false ,
410+ wantFromTemplate : nil ,
411+ },
412+ {
413+ name : "step-echo-pull default" ,
414+ failure : false ,
415+ container : & pipeline.Container {
416+ ID : "step_github_octocat_1_echo" ,
417+ Commands : []string {"echo" , "hello" },
418+ Directory : "/vela/src/github.com/octocat/helloworld" ,
419+ Environment : map [string ]string {"FOO" : "bar" },
420+ Entrypoint : []string {"/bin/sh" , "-c" },
421+ Image : "alpine:latest" ,
422+ Name : "echo" ,
423+ Number : 2 ,
424+ Pull : "" ,
352425 },
353426 opts : nil ,
354427 wantPrivileged : false ,
0 commit comments