@@ -10,6 +10,7 @@ import (
1010 "testing"
1111
1212 "github.com/go-vela/types/pipeline"
13+ "github.com/go-vela/worker/internal/image"
1314 velav1alpha1 "github.com/go-vela/worker/runtime/kubernetes/apis/vela/v1alpha1"
1415
1516 v1 "k8s.io/api/core/v1"
@@ -52,6 +53,53 @@ func TestKubernetes_InspectContainer(t *testing.T) {
5253 State : v1.ContainerState {
5354 Running : & v1.ContainerStateRunning {},
5455 },
56+ Image : _container .Image ,
57+ },
58+ },
59+ },
60+ },
61+ container : _container ,
62+ },
63+ {
64+ name : "build stops before container execution with raw pauseImage" ,
65+ failure : false ,
66+ pod : & v1.Pod {
67+ ObjectMeta : _pod .ObjectMeta ,
68+ TypeMeta : _pod .TypeMeta ,
69+ Spec : _pod .Spec ,
70+ Status : v1.PodStatus {
71+ Phase : v1 .PodRunning ,
72+ ContainerStatuses : []v1.ContainerStatus {
73+ {
74+ Name : "step-github-octocat-1-clone" ,
75+ State : v1.ContainerState {
76+ Running : & v1.ContainerStateRunning {},
77+ },
78+ // container not patched yet with correct image
79+ Image : pauseImage ,
80+ },
81+ },
82+ },
83+ },
84+ container : _container ,
85+ },
86+ {
87+ name : "build stops before container execution with canonical pauseImage" ,
88+ failure : false ,
89+ pod : & v1.Pod {
90+ ObjectMeta : _pod .ObjectMeta ,
91+ TypeMeta : _pod .TypeMeta ,
92+ Spec : _pod .Spec ,
93+ Status : v1.PodStatus {
94+ Phase : v1 .PodRunning ,
95+ ContainerStatuses : []v1.ContainerStatus {
96+ {
97+ Name : "step-github-octocat-1-clone" ,
98+ State : v1.ContainerState {
99+ Running : & v1.ContainerStateRunning {},
100+ },
101+ // container not patched yet with correct image
102+ Image : image .Parse (pauseImage ),
55103 },
56104 },
57105 },
@@ -411,6 +459,7 @@ func TestKubernetes_WaitContainer(t *testing.T) {
411459 ExitCode : 0 ,
412460 },
413461 },
462+ Image : "alpine:latest" ,
414463 },
415464 {
416465 Name : "step-github-octocat-1-clone" ,
@@ -420,6 +469,7 @@ func TestKubernetes_WaitContainer(t *testing.T) {
420469 ExitCode : 0 ,
421470 },
422471 },
472+ Image : "target/vela-git:v0.4.0" ,
423473 },
424474 },
425475 },
0 commit comments