Merge pull request #62635 from cofyc/reduce_e2e_timeout
Automatic merge from submit-queue (batch tested with PRs 59592, 62308, 62523, 62635, 62243). 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>. Use shorter timeout when we expecting failure **What this PR does / why we need it**: Use shorter timeout when we wait pod to not be running or PVC to not be bound **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #55174 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
		| @@ -1000,14 +1000,14 @@ func CreateNginxPod(client clientset.Interface, namespace string, nodeSelector m | |||||||
| } | } | ||||||
|  |  | ||||||
| // create security pod with given claims | // create security pod with given claims | ||||||
| func CreateSecPod(client clientset.Interface, namespace string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions, fsGroup *int64) (*v1.Pod, error) { | func CreateSecPod(client clientset.Interface, namespace string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions, fsGroup *int64, timeout time.Duration) (*v1.Pod, error) { | ||||||
| 	pod := MakeSecPod(namespace, pvclaims, isPrivileged, command, hostIPC, hostPID, seLinuxLabel, fsGroup) | 	pod := MakeSecPod(namespace, pvclaims, isPrivileged, command, hostIPC, hostPID, seLinuxLabel, fsGroup) | ||||||
| 	pod, err := client.CoreV1().Pods(namespace).Create(pod) | 	pod, err := client.CoreV1().Pods(namespace).Create(pod) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, fmt.Errorf("pod Create API error: %v", err) | 		return nil, fmt.Errorf("pod Create API error: %v", err) | ||||||
| 	} | 	} | ||||||
| 	// Waiting for pod to be running | 	// Waiting for pod to be running | ||||||
| 	err = WaitForPodNameRunningInNamespace(client, pod.Name, namespace) | 	err = WaitTimeoutForPodRunningInNamespace(client, pod.Name, namespace, timeout) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return pod, fmt.Errorf("pod %q is not Running: %v", pod.Name, err) | 		return pod, fmt.Errorf("pod %q is not Running: %v", pod.Name, err) | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -113,6 +113,11 @@ const ( | |||||||
| 	// TODO: Make this 30 seconds once #4566 is resolved. | 	// TODO: Make this 30 seconds once #4566 is resolved. | ||||||
| 	PodStartTimeout = 5 * time.Minute | 	PodStartTimeout = 5 * time.Minute | ||||||
|  |  | ||||||
|  | 	// Same as `PodStartTimeout` to wait for the pod to be started, but shorter. | ||||||
|  | 	// Use it case by case when we are sure pod start will not be delayed | ||||||
|  | 	// minutes by slow docker pulls or something else. | ||||||
|  | 	PodStartShortTimeout = 1 * time.Minute | ||||||
|  |  | ||||||
| 	// If there are any orphaned namespaces to clean up, this test is running | 	// If there are any orphaned namespaces to clean up, this test is running | ||||||
| 	// on a long lived cluster. A long wait here is preferably to spurious test | 	// on a long lived cluster. A long wait here is preferably to spurious test | ||||||
| 	// failures caused by leaked resources from a previous test run. | 	// failures caused by leaked resources from a previous test run. | ||||||
| @@ -156,6 +161,10 @@ const ( | |||||||
| 	// How long claims have to become dynamically provisioned | 	// How long claims have to become dynamically provisioned | ||||||
| 	ClaimProvisionTimeout = 5 * time.Minute | 	ClaimProvisionTimeout = 5 * time.Minute | ||||||
|  |  | ||||||
|  | 	// Same as `ClaimProvisionTimeout` to wait for claim to be dynamically provisioned, but shorter. | ||||||
|  | 	// Use it case by case when we are sure this timeout is enough. | ||||||
|  | 	ClaimProvisionShortTimeout = 1 * time.Minute | ||||||
|  |  | ||||||
| 	// How long claims have to become bound | 	// How long claims have to become bound | ||||||
| 	ClaimBindingTimeout = 3 * time.Minute | 	ClaimBindingTimeout = 3 * time.Minute | ||||||
|  |  | ||||||
|   | |||||||
| @@ -328,7 +328,6 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() { | |||||||
|  |  | ||||||
| 	Context("Local volume that cannot be mounted [Slow]", func() { | 	Context("Local volume that cannot be mounted [Slow]", func() { | ||||||
| 		// TODO: | 		// TODO: | ||||||
| 		// - make the pod create timeout shorter |  | ||||||
| 		// - check for these errors in unit tests intead | 		// - check for these errors in unit tests intead | ||||||
| 		It("should fail due to non-existent path", func() { | 		It("should fail due to non-existent path", func() { | ||||||
| 			ep := &eventPatterns{ | 			ep := &eventPatterns{ | ||||||
| @@ -368,7 +367,7 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() { | |||||||
| 			pod, err := config.client.CoreV1().Pods(config.ns).Create(pod) | 			pod, err := config.client.CoreV1().Pods(config.ns).Create(pod) | ||||||
| 			Expect(err).NotTo(HaveOccurred()) | 			Expect(err).NotTo(HaveOccurred()) | ||||||
|  |  | ||||||
| 			err = framework.WaitForPodNameRunningInNamespace(config.client, pod.Name, pod.Namespace) | 			err = framework.WaitTimeoutForPodRunningInNamespace(config.client, pod.Name, pod.Namespace, framework.PodStartShortTimeout) | ||||||
| 			Expect(err).To(HaveOccurred()) | 			Expect(err).To(HaveOccurred()) | ||||||
| 			checkPodEvents(config, pod.Name, ep) | 			checkPodEvents(config, pod.Name, ep) | ||||||
|  |  | ||||||
| @@ -1113,7 +1112,7 @@ func makeLocalPodWithNodeName(config *localTestConfig, volume *localTestVolume, | |||||||
|  |  | ||||||
| // createSecPod should be used when Pod requires non default SELinux labels | // createSecPod should be used when Pod requires non default SELinux labels | ||||||
| func createSecPod(config *localTestConfig, volume *localTestVolume, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions) (*v1.Pod, error) { | func createSecPod(config *localTestConfig, volume *localTestVolume, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions) (*v1.Pod, error) { | ||||||
| 	pod, err := framework.CreateSecPod(config.client, config.ns, []*v1.PersistentVolumeClaim{volume.pvc}, false, "", hostIPC, hostPID, seLinuxLabel, nil) | 	pod, err := framework.CreateSecPod(config.client, config.ns, []*v1.PersistentVolumeClaim{volume.pvc}, false, "", hostIPC, hostPID, seLinuxLabel, nil, framework.PodStartShortTimeout) | ||||||
| 	podNodeName, podNodeNameErr := podNodeName(config, pod) | 	podNodeName, podNodeNameErr := podNodeName(config, pod) | ||||||
| 	Expect(podNodeNameErr).NotTo(HaveOccurred()) | 	Expect(podNodeNameErr).NotTo(HaveOccurred()) | ||||||
| 	framework.Logf("Security Context POD %q created on Node %q", pod.Name, podNodeName) | 	framework.Logf("Security Context POD %q created on Node %q", pod.Name, podNodeName) | ||||||
| @@ -1123,7 +1122,7 @@ func createSecPod(config *localTestConfig, volume *localTestVolume, hostIPC bool | |||||||
|  |  | ||||||
| func createLocalPod(config *localTestConfig, volume *localTestVolume, fsGroup *int64) (*v1.Pod, error) { | func createLocalPod(config *localTestConfig, volume *localTestVolume, fsGroup *int64) (*v1.Pod, error) { | ||||||
| 	By("Creating a pod") | 	By("Creating a pod") | ||||||
| 	return framework.CreateSecPod(config.client, config.ns, []*v1.PersistentVolumeClaim{volume.pvc}, false, "", false, false, selinuxLabel, fsGroup) | 	return framework.CreateSecPod(config.client, config.ns, []*v1.PersistentVolumeClaim{volume.pvc}, false, "", false, false, selinuxLabel, fsGroup, framework.PodStartShortTimeout) | ||||||
| } | } | ||||||
|  |  | ||||||
| func createAndMountTmpfsLocalVolume(config *localTestConfig, dir string, node *v1.Node) { | func createAndMountTmpfsLocalVolume(config *localTestConfig, dir string, node *v1.Node) { | ||||||
|   | |||||||
| @@ -483,9 +483,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { | |||||||
| 			testDynamicProvisioning(test, c, claim, class) | 			testDynamicProvisioning(test, c, claim, class) | ||||||
| 		}) | 		}) | ||||||
|  |  | ||||||
| 		// NOTE: Slow!  The test will wait up to 5 minutes (framework.ClaimProvisionTimeout) | 		It("should not provision a volume in an unmanaged GCE zone.", func() { | ||||||
| 		// when there is no regression. |  | ||||||
| 		It("should not provision a volume in an unmanaged GCE zone. [Slow]", func() { |  | ||||||
| 			framework.SkipUnlessProviderIs("gce", "gke") | 			framework.SkipUnlessProviderIs("gce", "gke") | ||||||
| 			var suffix string = "unmananged" | 			var suffix string = "unmananged" | ||||||
|  |  | ||||||
| @@ -538,7 +536,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { | |||||||
| 			}() | 			}() | ||||||
|  |  | ||||||
| 			// The claim should timeout phase:Pending | 			// The claim should timeout phase:Pending | ||||||
| 			err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, c, ns, pvc.Name, 2*time.Second, framework.ClaimProvisionTimeout) | 			err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, c, ns, pvc.Name, 2*time.Second, framework.ClaimProvisionShortTimeout) | ||||||
| 			Expect(err).To(HaveOccurred()) | 			Expect(err).To(HaveOccurred()) | ||||||
| 			framework.Logf(err.Error()) | 			framework.Logf(err.Error()) | ||||||
| 		}) | 		}) | ||||||
| @@ -722,7 +720,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { | |||||||
| 		}) | 		}) | ||||||
|  |  | ||||||
| 		// Modifying the default storage class can be disruptive to other tests that depend on it | 		// Modifying the default storage class can be disruptive to other tests that depend on it | ||||||
| 		It("should be disabled by changing the default annotation[Slow] [Serial] [Disruptive]", func() { | 		It("should be disabled by changing the default annotation [Serial] [Disruptive]", func() { | ||||||
| 			framework.SkipUnlessProviderIs("openstack", "gce", "aws", "gke", "vsphere", "azure") | 			framework.SkipUnlessProviderIs("openstack", "gce", "aws", "gke", "vsphere", "azure") | ||||||
| 			scName := getDefaultStorageClassName(c) | 			scName := getDefaultStorageClassName(c) | ||||||
| 			test := storageClassTest{ | 			test := storageClassTest{ | ||||||
| @@ -744,7 +742,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { | |||||||
| 			}() | 			}() | ||||||
|  |  | ||||||
| 			// The claim should timeout phase:Pending | 			// The claim should timeout phase:Pending | ||||||
| 			err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, c, ns, claim.Name, 2*time.Second, framework.ClaimProvisionTimeout) | 			err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, c, ns, claim.Name, 2*time.Second, framework.ClaimProvisionShortTimeout) | ||||||
| 			Expect(err).To(HaveOccurred()) | 			Expect(err).To(HaveOccurred()) | ||||||
| 			framework.Logf(err.Error()) | 			framework.Logf(err.Error()) | ||||||
| 			claim, err = c.CoreV1().PersistentVolumeClaims(ns).Get(claim.Name, metav1.GetOptions{}) | 			claim, err = c.CoreV1().PersistentVolumeClaims(ns).Get(claim.Name, metav1.GetOptions{}) | ||||||
| @@ -753,7 +751,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { | |||||||
| 		}) | 		}) | ||||||
|  |  | ||||||
| 		// Modifying the default storage class can be disruptive to other tests that depend on it | 		// Modifying the default storage class can be disruptive to other tests that depend on it | ||||||
| 		It("should be disabled by removing the default annotation[Slow] [Serial] [Disruptive]", func() { | 		It("should be disabled by removing the default annotation [Serial] [Disruptive]", func() { | ||||||
| 			framework.SkipUnlessProviderIs("openstack", "gce", "aws", "gke", "vsphere", "azure") | 			framework.SkipUnlessProviderIs("openstack", "gce", "aws", "gke", "vsphere", "azure") | ||||||
| 			scName := getDefaultStorageClassName(c) | 			scName := getDefaultStorageClassName(c) | ||||||
| 			test := storageClassTest{ | 			test := storageClassTest{ | ||||||
| @@ -775,7 +773,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { | |||||||
| 			}() | 			}() | ||||||
|  |  | ||||||
| 			// The claim should timeout phase:Pending | 			// The claim should timeout phase:Pending | ||||||
| 			err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, c, ns, claim.Name, 2*time.Second, framework.ClaimProvisionTimeout) | 			err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, c, ns, claim.Name, 2*time.Second, framework.ClaimProvisionShortTimeout) | ||||||
| 			Expect(err).To(HaveOccurred()) | 			Expect(err).To(HaveOccurred()) | ||||||
| 			framework.Logf(err.Error()) | 			framework.Logf(err.Error()) | ||||||
| 			claim, err = c.CoreV1().PersistentVolumeClaims(ns).Get(claim.Name, metav1.GetOptions{}) | 			claim, err = c.CoreV1().PersistentVolumeClaims(ns).Get(claim.Name, metav1.GetOptions{}) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Submit Queue
					Kubernetes Submit Queue