From 00b6d7ccee30b435509e1547916ab1b42738ff21 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Thu, 17 Sep 2020 15:55:35 +0200 Subject: [PATCH] e2e: add option to create pods with different image in pod.Config For testing certain features, the BusyBox image does not provide all the tools that are needed. Notably 'dd' from BusyBox does not support direct-io that is required for skipping caches while doing writes and reads on a Block-mode PVC attached to different nodes. --- test/e2e/framework/pod/create.go | 7 ++++++- test/utils/image/manifest.go | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/e2e/framework/pod/create.go b/test/e2e/framework/pod/create.go index beb31fdfb4d..353fb8cb9f2 100644 --- a/test/e2e/framework/pod/create.go +++ b/test/e2e/framework/pod/create.go @@ -48,6 +48,7 @@ type Config struct { SeLinuxLabel *v1.SELinuxOptions FsGroup *int64 NodeSelection NodeSelection + ImageID int } // CreateUnschedulablePod with given claims based on node selector @@ -185,6 +186,10 @@ func MakeSecPod(podConfig *Config) (*v1.Pod, error) { return &i }(1000) } + image := imageutils.BusyBox + if podConfig.ImageID != imageutils.None { + image = podConfig.ImageID + } podSpec := &v1.Pod{ TypeMeta: metav1.TypeMeta{ Kind: "Pod", @@ -203,7 +208,7 @@ func MakeSecPod(podConfig *Config) (*v1.Pod, error) { Containers: []v1.Container{ { Name: "write-pod", - Image: imageutils.GetE2EImage(imageutils.BusyBox), + Image: imageutils.GetE2EImage(image), Command: []string{"/bin/sh"}, Args: []string{"-c", podConfig.Command}, SecurityContext: &v1.SecurityContext{ diff --git a/test/utils/image/manifest.go b/test/utils/image/manifest.go index 284a2733f91..86caa0218fc 100644 --- a/test/utils/image/manifest.go +++ b/test/utils/image/manifest.go @@ -119,8 +119,10 @@ var ( ) const ( + // None is to be used for unset/default images + None = iota // Agnhost image - Agnhost = iota + Agnhost // AgnhostPrivate image AgnhostPrivate // APIServer image