From 33fc389a91bc2cd6f0b379c7b8ca6410cf856c72 Mon Sep 17 00:00:00 2001 From: Mayank Gaikwad <8110509+mgdevstack@users.noreply.github.com> Date: Thu, 2 Aug 2018 23:15:47 +0530 Subject: [PATCH] added new conforamnce test under NodeConformance verifying InitContainer PodSpec and improves api coverage --- test/conformance/testdata/conformance.txt | 4 +++ test/e2e/common/init_container.go | 38 ++++++++++++++++++++--- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/test/conformance/testdata/conformance.txt b/test/conformance/testdata/conformance.txt index 63669ecec5e..a1c28cda297 100755 --- a/test/conformance/testdata/conformance.txt +++ b/test/conformance/testdata/conformance.txt @@ -82,6 +82,10 @@ test/e2e/common/expansion.go: "should allow composing env vars into new env vars test/e2e/common/expansion.go: "should allow substituting values in a container's command" test/e2e/common/expansion.go: "should allow substituting values in a container's args" test/e2e/common/host_path.go: "should give a volume the correct mode" +test/e2e/common/init_container.go: "should invoke init containers on a RestartNever pod" +test/e2e/common/init_container.go: "should invoke init containers on a RestartAlways pod" +test/e2e/common/init_container.go: "should not start app containers if init containers fail on a RestartAlways pod" +test/e2e/common/init_container.go: "should not start app containers and fail the pod if init containers fail on a RestartNever pod" test/e2e/common/kubelet_etc_hosts.go: "should test kubelet managed /etc/hosts file" test/e2e/common/networking.go: "should function for intra-pod communication: http" test/e2e/common/networking.go: "should function for intra-pod communication: udp" diff --git a/test/e2e/common/init_container.go b/test/e2e/common/init_container.go index ad32cc8414a..e5e36a9ab1f 100644 --- a/test/e2e/common/init_container.go +++ b/test/e2e/common/init_container.go @@ -42,7 +42,15 @@ var _ = framework.KubeDescribe("InitContainer [NodeConformance]", func() { podClient = f.PodClient() }) - It("should invoke init containers on a RestartNever pod", func() { + /* + Release: v1.12 + Testname: init-container-starts-app-restartnever-pod + Description: Ensure that all InitContainers are started + and all containers in pod are voluntarily terminated with exit status 0, + and the system is not going to restart any of these containers + when Pod has restart policy as RestartNever. + */ + framework.ConformanceIt("should invoke init containers on a RestartNever pod", func() { By("creating the pod") name := "pod-init-" + string(uuid.NewUUID()) value := strconv.Itoa(time.Now().Nanosecond()) @@ -99,7 +107,15 @@ var _ = framework.KubeDescribe("InitContainer [NodeConformance]", func() { } }) - It("should invoke init containers on a RestartAlways pod", func() { + /* + Release: v1.12 + Testname: init-container-starts-app-restartalways-pod + Description: Ensure that all InitContainers are started + and all containers in pod started + and at least one container is still running or is in the process of being restarted + when Pod has restart policy as RestartAlways. + */ + framework.ConformanceIt("should invoke init containers on a RestartAlways pod", func() { By("creating the pod") name := "pod-init-" + string(uuid.NewUUID()) value := strconv.Itoa(time.Now().Nanosecond()) @@ -160,7 +176,15 @@ var _ = framework.KubeDescribe("InitContainer [NodeConformance]", func() { } }) - It("should not start app containers if init containers fail on a RestartAlways pod", func() { + /* + Release: v1.12 + Testname: init-container-fails-stops-app-restartalways-pod + Description: Ensure that app container is not started + when all InitContainers failed to start + and Pod has restarted for few occurrences + and pod has restart policy as RestartAlways. + */ + framework.ConformanceIt("should not start app containers if init containers fail on a RestartAlways pod", func() { By("creating the pod") name := "pod-init-" + string(uuid.NewUUID()) value := strconv.Itoa(time.Now().Nanosecond()) @@ -268,7 +292,13 @@ var _ = framework.KubeDescribe("InitContainer [NodeConformance]", func() { Expect(len(endPod.Status.InitContainerStatuses)).To(Equal(2)) }) - It("should not start app containers and fail the pod if init containers fail on a RestartNever pod", func() { + /* + Release: v1.12 + Testname: init-container-fails-stops-app-restartnever-pod + Description: Ensure that app container is not started + when atleast one InitContainer fails to start and Pod has restart policy as RestartNever. + */ + framework.ConformanceIt("should not start app containers and fail the pod if init containers fail on a RestartNever pod", func() { By("creating the pod") name := "pod-init-" + string(uuid.NewUUID()) value := strconv.Itoa(time.Now().Nanosecond())