mirror of https://github.com/k3s-io/k3s
Extend timeouts in taints test to account for slow Pod deletions
parent
c38717b73a
commit
4e5b4e7ee0
|
@ -134,6 +134,11 @@ func createTestController(cs clientset.Interface, observedDeletions chan struct{
|
||||||
go controller.Run(stopCh)
|
go controller.Run(stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
KubeletPodDeletionDelaySeconds = 60
|
||||||
|
AdditionalWaitPerDeleteSeconds = 5
|
||||||
|
)
|
||||||
|
|
||||||
// Tests the behavior of NoExecuteTaintManager. Following scenarios are included:
|
// Tests the behavior of NoExecuteTaintManager. Following scenarios are included:
|
||||||
// - eviction of non-tolerating pods from a tainted node,
|
// - eviction of non-tolerating pods from a tainted node,
|
||||||
// - lack of eviction of 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
|
// Wait a bit
|
||||||
By("Waiting for Pod to be deleted")
|
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 {
|
select {
|
||||||
case <-timeoutChannel:
|
case <-timeoutChannel:
|
||||||
framework.Failf("Failed to evict Pod")
|
framework.Failf("Failed to evict Pod")
|
||||||
|
@ -211,7 +216,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() {
|
||||||
|
|
||||||
// Wait a bit
|
// Wait a bit
|
||||||
By("Waiting for Pod to be deleted")
|
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 {
|
select {
|
||||||
case <-timeoutChannel:
|
case <-timeoutChannel:
|
||||||
framework.Logf("Pod wasn't evicted. Test successful")
|
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
|
// 4. See if pod will get evicted after toleration time runs out
|
||||||
It("eventually evict pod with finite tolerations from tainted nodes", func() {
|
It("eventually evict pod with finite tolerations from tainted nodes", func() {
|
||||||
podName := "taint-eviction-3"
|
podName := "taint-eviction-3"
|
||||||
pod := createPodForTaintsTest(true, 5, podName, ns)
|
pod := createPodForTaintsTest(true, KubeletPodDeletionDelaySeconds+2*AdditionalWaitPerDeleteSeconds, podName, ns)
|
||||||
observedDeletions := make(chan struct{}, 100)
|
observedDeletions := make(chan struct{}, 100)
|
||||||
stopCh := make(chan struct{})
|
stopCh := make(chan struct{})
|
||||||
createTestController(cs, observedDeletions, stopCh, podName, ns)
|
createTestController(cs, observedDeletions, stopCh, podName, ns)
|
||||||
|
@ -244,7 +249,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() {
|
||||||
|
|
||||||
// Wait a bit
|
// Wait a bit
|
||||||
By("Waiting to see if a Pod won't be deleted")
|
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 {
|
select {
|
||||||
case <-timeoutChannel:
|
case <-timeoutChannel:
|
||||||
framework.Logf("Pod wasn't evicted")
|
framework.Logf("Pod wasn't evicted")
|
||||||
|
@ -253,7 +258,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
By("Waiting for Pod to be deleted")
|
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 {
|
select {
|
||||||
case <-timeoutChannel:
|
case <-timeoutChannel:
|
||||||
framework.Failf("Pod wasn't evicted")
|
framework.Failf("Pod wasn't evicted")
|
||||||
|
@ -270,7 +275,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() {
|
||||||
// 5. See if Pod won't be evicted.
|
// 5. See if Pod won't be evicted.
|
||||||
It("removing taint cancels eviction", func() {
|
It("removing taint cancels eviction", func() {
|
||||||
podName := "taint-eviction-4"
|
podName := "taint-eviction-4"
|
||||||
pod := createPodForTaintsTest(true, 5, podName, ns)
|
pod := createPodForTaintsTest(true, 2*AdditionalWaitPerDeleteSeconds, podName, ns)
|
||||||
observedDeletions := make(chan struct{}, 100)
|
observedDeletions := make(chan struct{}, 100)
|
||||||
stopCh := make(chan struct{})
|
stopCh := make(chan struct{})
|
||||||
createTestController(cs, observedDeletions, stopCh, podName, ns)
|
createTestController(cs, observedDeletions, stopCh, podName, ns)
|
||||||
|
@ -293,7 +298,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() {
|
||||||
|
|
||||||
// Wait a bit
|
// Wait a bit
|
||||||
By("Waiting short time to make sure Pod is queued for deletion")
|
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 {
|
select {
|
||||||
case <-timeoutChannel:
|
case <-timeoutChannel:
|
||||||
framework.Logf("Pod wasn't evicted. Proceeding")
|
framework.Logf("Pod wasn't evicted. Proceeding")
|
||||||
|
@ -305,7 +310,7 @@ var _ = framework.KubeDescribe("NoExecuteTaintManager [Serial]", func() {
|
||||||
framework.RemoveTaintOffNode(cs, nodeName, testTaint)
|
framework.RemoveTaintOffNode(cs, nodeName, testTaint)
|
||||||
taintRemoved = true
|
taintRemoved = true
|
||||||
By("Waiting some time to make sure that toleration time passed.")
|
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 {
|
select {
|
||||||
case <-timeoutChannel:
|
case <-timeoutChannel:
|
||||||
framework.Logf("Pod wasn't evicted. Test successful")
|
framework.Logf("Pod wasn't evicted. Test successful")
|
||||||
|
|
Loading…
Reference in New Issue