Unverified Commit dc663c0b authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #66405 from davidz627/fix/subpathTestTimeout

Automatic merge from submit-queue (batch tested with PRs 66341, 66405, 66403, 66264, 66447). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Bump subpath test pod timeout to 5 minutes Fixes: #66376 It seems that sometimes `Attach` on GCP side can take multiple minutes (when recently detached from another node) and therefore the old timeout of 1 minute is not long enough. 5 minutes is standard elsewhere and seems to be long enough for the long tail of GCE Attach time. Also the ext4 test was really hard to debug because all the old PD tests call all the pods "pd-injector" and all the volume mounts "pd-volume." Made a change to make that more readable by adding a length 4 random string suffix. /kind flake /sig storage /assign @msau42 ```release-note NONE ```
parents 098e971c 8e85b786
...@@ -41,12 +41,14 @@ package framework ...@@ -41,12 +41,14 @@ package framework
import ( import (
"fmt" "fmt"
"strconv" "strconv"
"time" "time"
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
apierrs "k8s.io/apimachinery/pkg/api/errors" apierrs "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/rand"
clientset "k8s.io/client-go/kubernetes" clientset "k8s.io/client-go/kubernetes"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
...@@ -477,6 +479,8 @@ func TestVolumeClient(client clientset.Interface, config VolumeTestConfig, fsGro ...@@ -477,6 +479,8 @@ func TestVolumeClient(client clientset.Interface, config VolumeTestConfig, fsGro
func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.VolumeSource, content string) { func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.VolumeSource, content string) {
By(fmt.Sprint("starting ", config.Prefix, " injector")) By(fmt.Sprint("starting ", config.Prefix, " injector"))
podClient := client.CoreV1().Pods(config.Namespace) 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{ injectPod := &v1.Pod{
TypeMeta: metav1.TypeMeta{ TypeMeta: metav1.TypeMeta{
...@@ -484,7 +488,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V ...@@ -484,7 +488,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V
APIVersion: "v1", APIVersion: "v1",
}, },
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: config.Prefix + "-injector", Name: podName,
Labels: map[string]string{ Labels: map[string]string{
"role": config.Prefix + "-injector", "role": config.Prefix + "-injector",
}, },
...@@ -498,7 +502,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V ...@@ -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"}, Args: []string{"-c", "echo '" + content + "' > /mnt/index.html && chmod o+rX /mnt /mnt/index.html"},
VolumeMounts: []v1.VolumeMount{ VolumeMounts: []v1.VolumeMount{
{ {
Name: config.Prefix + "-volume", Name: volMountName,
MountPath: "/mnt", MountPath: "/mnt",
}, },
}, },
...@@ -512,7 +516,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V ...@@ -512,7 +516,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V
RestartPolicy: v1.RestartPolicyNever, RestartPolicy: v1.RestartPolicyNever,
Volumes: []v1.Volume{ Volumes: []v1.Volume{
{ {
Name: config.Prefix + "-volume", Name: volMountName,
VolumeSource: volume, VolumeSource: volume,
}, },
}, },
...@@ -521,7 +525,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V ...@@ -521,7 +525,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V
} }
defer func() { defer func() {
podClient.Delete(config.Prefix+"-injector", nil) podClient.Delete(podName, nil)
}() }()
injectPod, err := podClient.Create(injectPod) injectPod, err := podClient.Create(injectPod)
......
...@@ -513,7 +513,7 @@ func testPodFailSubpathError(f *framework.Framework, pod *v1.Pod, errorMsg strin ...@@ -513,7 +513,7 @@ func testPodFailSubpathError(f *framework.Framework, pod *v1.Pod, errorMsg strin
defer func() { defer func() {
framework.DeletePodWithWait(f, f.ClientSet, pod) 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") Expect(err).To(HaveOccurred(), "while waiting for pod to be running")
By("Checking for subpath error event") By("Checking for subpath error event")
...@@ -556,7 +556,7 @@ func testPodContainerRestart(f *framework.Framework, pod *v1.Pod) { ...@@ -556,7 +556,7 @@ func testPodContainerRestart(f *framework.Framework, pod *v1.Pod) {
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod) pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod)
Expect(err).ToNot(HaveOccurred(), "while creating 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") Expect(err).ToNot(HaveOccurred(), "while waiting for pod to be running")
By("Failing liveness probe") By("Failing liveness probe")
...@@ -641,7 +641,7 @@ func testSubpathReconstruction(f *framework.Framework, pod *v1.Pod, forceDelete ...@@ -641,7 +641,7 @@ func testSubpathReconstruction(f *framework.Framework, pod *v1.Pod, forceDelete
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod) pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod)
Expect(err).ToNot(HaveOccurred(), "while creating 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") 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{}) pod, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(pod.Name, metav1.GetOptions{})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment