From d80bbb9d57ae9d08d5c3ee5fd627496b8fcc77f1 Mon Sep 17 00:00:00 2001 From: soggiest Date: Wed, 28 Nov 2018 15:09:37 -0800 Subject: [PATCH] PodPreset: Added tests to verify initcontainers modified as expected --- test/e2e/servicecatalog/podpreset.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/e2e/servicecatalog/podpreset.go b/test/e2e/servicecatalog/podpreset.go index 260c1790a2a..e16d5ce9669 100644 --- a/test/e2e/servicecatalog/podpreset.go +++ b/test/e2e/servicecatalog/podpreset.go @@ -99,6 +99,13 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() { Image: imageutils.GetE2EImage(imageutils.Nginx), }, }, + InitContainers: []v1.Container{ + { + Name: "init1", + Image: imageutils.GetE2EImage(imageutils.BusyBox), + Command: []string{"/bin/true"}, + }, + }, }, } @@ -153,6 +160,9 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() { if !reflect.DeepEqual(pip.Spec.Env, pod.Spec.Containers[0].Env) { framework.Failf("env of pod container does not match the env of the pip: expected %#v, got: %#v", pip.Spec.Env, pod.Spec.Containers[0].Env) } + if !reflect.DeepEqual(pip.Spec.Env, pod.Spec.InitContainers[0].Env) { + framework.Failf("env of pod init container does not match the env of the pip: expected %#v, got: %#v", pip.Spec.Env, pod.Spec.InitContainers[0].Env) + } }) It("should not modify the pod on conflict", func() { @@ -208,6 +218,14 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() { Env: []v1.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: "value"}}, }, }, + InitContainers: []v1.Container{ + { + Name: "init1", + Image: imageutils.GetE2EImage(imageutils.BusyBox), + Env: []v1.EnvVar{{Name: "abc", Value: "value2"}, {Name: "ABC", Value: " value"}}, + Command: []string{"/bin/true"}, + }, + }, }, } @@ -262,6 +280,10 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() { if !reflect.DeepEqual(originalPod.Spec.Containers[0].Env, pod.Spec.Containers[0].Env) { framework.Failf("env of pod container does not match the env of the original pod: expected %#v, got: %#v", originalPod.Spec.Containers[0].Env, pod.Spec.Containers[0].Env) } + if !reflect.DeepEqual(originalPod.Spec.InitContainers[0].Env, pod.Spec.InitContainers[0].Env) { + framework.Failf("env of pod init container does not match the env of the original pod: expected %#v, g ot: %#v", originalPod.Spec.InitContainers[0].Env, pod.Spec.InitContainers[0].Env) + } + }) })