@@ -302,6 +302,45 @@ var _ = Describe("Service Controller", func() {
302302 Expect (instance .Status .IsRunning ()).To (BeTrue ())
303303 Expect (instance .Status .IsWarning ()).To (BeFalse ())
304304 })
305+
306+ It ("should fail services whose image name is invalid" , func () {
307+ labels := map [string ]string {"app.kubernetes.io/instance" : "test-service-invalid-image" }
308+ instance := newInstance ("test-service-invalid-image" , labels )
309+ pod := & corev1.Pod {
310+ ObjectMeta : metav1.ObjectMeta {
311+ Name : "test-service-invalid-image-pod" ,
312+ Namespace : "default" ,
313+ Labels : labels ,
314+ },
315+ Status : corev1.PodStatus {
316+ Phase : corev1 .PodPending ,
317+ Conditions : []corev1.PodCondition {
318+ {Type : corev1 .PodReady , Status : corev1 .ConditionFalse , Reason : "ContainersNotReady" },
319+ },
320+ ContainerStatuses : []corev1.ContainerStatus {
321+ {
322+ Name : "polyaxon-main" ,
323+ State : corev1.ContainerState {
324+ Waiting : & corev1.ContainerStateWaiting {
325+ Reason : "InvalidImageName" ,
326+ Message : `couldn't parse image name "Busybox:latest"` ,
327+ },
328+ },
329+ },
330+ },
331+ },
332+ }
333+ setFakeClient (instance , pod )
334+
335+ updated := reconciler .reconcileDeploymentStatus (instance , appsv1.Deployment {})
336+
337+ Expect (updated ).To (BeTrue ())
338+ Expect (instance .Status .IsFailed ()).To (BeTrue ())
339+ Expect (instance .Status .CompletionTime ).NotTo (BeNil ())
340+ condition := instance .Status .Conditions [len (instance .Status .Conditions )- 1 ]
341+ Expect (condition .Reason ).To (Equal ("InvalidImageName" ))
342+ Expect (condition .Message ).To (Equal (`couldn't parse image name "Busybox:latest"` ))
343+ })
305344 })
306345
307346 Context ("When handling service container exits" , func () {
0 commit comments