From 01f22dd4bfb0e844f8c3aa0cab7e4bfe80c99b28 Mon Sep 17 00:00:00 2001 From: David Zhu Date: Thu, 19 Jul 2018 13:54:05 -0700 Subject: [PATCH 1/2] Modified HTML injector to have more distinguishable names for debugging ease --- test/e2e/framework/volume_util.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/e2e/framework/volume_util.go b/test/e2e/framework/volume_util.go index ce97bcf2dcf..7bb0543e025 100644 --- a/test/e2e/framework/volume_util.go +++ b/test/e2e/framework/volume_util.go @@ -41,12 +41,14 @@ package framework import ( "fmt" + "strconv" "time" "k8s.io/api/core/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/rand" clientset "k8s.io/client-go/kubernetes" imageutils "k8s.io/kubernetes/test/utils/image" @@ -477,6 +479,8 @@ func TestVolumeClient(client clientset.Interface, config VolumeTestConfig, fsGro func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.VolumeSource, content string) { By(fmt.Sprint("starting ", config.Prefix, " injector")) podClient := client.CoreV1().Pods(config.Namespace) + podName := fmt.Sprintf("%s-injector-%s", config.Prefix, rand.String(4)) + volMountName := fmt.Sprintf("%s-volume-%s", config.Prefix, rand.String(4)) injectPod := &v1.Pod{ TypeMeta: metav1.TypeMeta{ @@ -484,7 +488,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V APIVersion: "v1", }, ObjectMeta: metav1.ObjectMeta{ - Name: config.Prefix + "-injector", + Name: podName, Labels: map[string]string{ "role": config.Prefix + "-injector", }, @@ -498,7 +502,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V Args: []string{"-c", "echo '" + content + "' > /mnt/index.html && chmod o+rX /mnt /mnt/index.html"}, VolumeMounts: []v1.VolumeMount{ { - Name: config.Prefix + "-volume", + Name: volMountName, MountPath: "/mnt", }, }, @@ -512,7 +516,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V RestartPolicy: v1.RestartPolicyNever, Volumes: []v1.Volume{ { - Name: config.Prefix + "-volume", + Name: volMountName, VolumeSource: volume, }, }, @@ -521,7 +525,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V } defer func() { - podClient.Delete(config.Prefix+"-injector", nil) + podClient.Delete(podName, nil) }() injectPod, err := podClient.Create(injectPod) From 8e85b78652d7a1bd5e0e64391b698fbfc9132292 Mon Sep 17 00:00:00 2001 From: David Zhu Date: Thu, 19 Jul 2018 13:25:09 -0700 Subject: [PATCH 2/2] Changed subpath test pod to use standard 5 minute timeout wait function, bumped from 1 minute --- test/e2e/storage/subpath.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/storage/subpath.go b/test/e2e/storage/subpath.go index 4e357b6eb9c..18618416ee4 100644 --- a/test/e2e/storage/subpath.go +++ b/test/e2e/storage/subpath.go @@ -513,7 +513,7 @@ func testPodFailSubpathError(f *framework.Framework, pod *v1.Pod, errorMsg strin defer func() { framework.DeletePodWithWait(f, f.ClientSet, pod) }() - err = framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, time.Minute) + err = framework.WaitForPodRunningInNamespace(f.ClientSet, pod) Expect(err).To(HaveOccurred(), "while waiting for pod to be running") By("Checking for subpath error event") @@ -556,7 +556,7 @@ func testPodContainerRestart(f *framework.Framework, pod *v1.Pod) { pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod) Expect(err).ToNot(HaveOccurred(), "while creating pod") - err = framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, time.Minute) + err = framework.WaitForPodRunningInNamespace(f.ClientSet, pod) Expect(err).ToNot(HaveOccurred(), "while waiting for pod to be running") By("Failing liveness probe") @@ -641,7 +641,7 @@ func testSubpathReconstruction(f *framework.Framework, pod *v1.Pod, forceDelete pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod) Expect(err).ToNot(HaveOccurred(), "while creating pod") - err = framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, time.Minute) + err = framework.WaitForPodRunningInNamespace(f.ClientSet, pod) Expect(err).ToNot(HaveOccurred(), "while waiting for pod to be running") pod, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(pod.Name, metav1.GetOptions{})