diff --git a/test/e2e/taints_test.go b/test/e2e/taints_test.go index ac62b0d697b..0061c0991df 100644 --- a/test/e2e/taints_test.go +++ b/test/e2e/taints_test.go @@ -134,6 +134,11 @@ func createTestController(cs clientset.Interface, observedDeletions chan struct{ go controller.Run(stopCh) } +const ( + KubeletPodDeletionDelaySeconds = 60 + AdditionalWaitPerDeleteSeconds = 5 +) + // Tests the behavior of NoExecuteTaintManager. Following scenarios are included: // - eviction of non-tolerating pods from a tainted node, // - lack of eviction of tolerating pods from a tainted node, @@ -179,7 +184,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() { // Wait a bit By("Waiting for Pod to be deleted") - timeoutChannel := time.NewTimer(10 * time.Second).C + timeoutChannel := time.NewTimer(time.Duration(KubeletPodDeletionDelaySeconds+AdditionalWaitPerDeleteSeconds) * time.Second).C select { case <-timeoutChannel: framework.Failf("Failed to evict Pod") @@ -211,7 +216,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() { // Wait a bit By("Waiting for Pod to be deleted") - timeoutChannel := time.NewTimer(10 * time.Second).C + timeoutChannel := time.NewTimer(time.Duration(KubeletPodDeletionDelaySeconds+AdditionalWaitPerDeleteSeconds) * time.Second).C select { case <-timeoutChannel: framework.Logf("Pod wasn't evicted. Test successful") @@ -226,7 +231,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() { // 4. See if pod will get evicted after toleration time runs out It("eventually evict pod with finite tolerations from tainted nodes", func() { podName := "taint-eviction-3" - pod := createPodForTaintsTest(true, 5, podName, ns) + pod := createPodForTaintsTest(true, KubeletPodDeletionDelaySeconds+2*AdditionalWaitPerDeleteSeconds, podName, ns) observedDeletions := make(chan struct{}, 100) stopCh := make(chan struct{}) createTestController(cs, observedDeletions, stopCh, podName, ns) @@ -244,7 +249,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() { // Wait a bit By("Waiting to see if a Pod won't be deleted") - timeoutChannel := time.NewTimer(2 * time.Second).C + timeoutChannel := time.NewTimer(time.Duration(KubeletPodDeletionDelaySeconds+AdditionalWaitPerDeleteSeconds) * time.Second).C select { case <-timeoutChannel: framework.Logf("Pod wasn't evicted") @@ -253,7 +258,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() { return } By("Waiting for Pod to be deleted") - timeoutChannel = time.NewTimer(10 * time.Second).C + timeoutChannel = time.NewTimer(time.Duration(KubeletPodDeletionDelaySeconds+AdditionalWaitPerDeleteSeconds) * time.Second).C select { case <-timeoutChannel: framework.Failf("Pod wasn't evicted") @@ -270,7 +275,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() { // 5. See if Pod won't be evicted. It("removing taint cancels eviction", func() { podName := "taint-eviction-4" - pod := createPodForTaintsTest(true, 5, podName, ns) + pod := createPodForTaintsTest(true, 2*AdditionalWaitPerDeleteSeconds, podName, ns) observedDeletions := make(chan struct{}, 100) stopCh := make(chan struct{}) createTestController(cs, observedDeletions, stopCh, podName, ns) @@ -293,7 +298,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() { // Wait a bit By("Waiting short time to make sure Pod is queued for deletion") - timeoutChannel := time.NewTimer(2 * time.Second).C + timeoutChannel := time.NewTimer(AdditionalWaitPerDeleteSeconds).C select { case <-timeoutChannel: framework.Logf("Pod wasn't evicted. Proceeding") @@ -305,7 +310,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() { framework.RemoveTaintOffNode(cs, nodeName, testTaint) taintRemoved = true By("Waiting some time to make sure that toleration time passed.") - timeoutChannel = time.NewTimer(10 * time.Second).C + timeoutChannel = time.NewTimer(time.Duration(KubeletPodDeletionDelaySeconds+3*AdditionalWaitPerDeleteSeconds) * time.Second).C select { case <-timeoutChannel: framework.Logf("Pod wasn't evicted. Test successful")