Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorten Timeouts for E2e Tests #113

Merged
merged 2 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions test/e2e/far_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ const (

//TODO: try to minimize timeout
// eventually parameters
timeoutLogs = 3 * time.Minute
timeoutReboot = 6 * time.Minute // fencing with fence_aws should be completed within 6 minutes
timeoutDeletion = 10 * time.Second // this timeout is used after all the other steps have been succesfult
pollDeletion = 250 * time.Millisecond
pollInterval = 10 * time.Second
timeoutLogs = "3m0s"
timeoutTaint = "2s" // Timeout for checking the FAR taint
timeoutReboot = "6m0s" // fencing with fence_aws should be completed within 6 minutes
timeoutAfterReboot = "5s" // Timeout for verifying steps after the node has been rebooted
pollTaint = "100ms"
pollReboot = "1s"
pollAfterReboot = "250ms"
)

var remediationTimes []time.Duration
Expand Down Expand Up @@ -299,7 +301,7 @@ func wasFarTaintAdded(nodeName string) {
node, err = utils.GetNodeWithName(k8sClient, nodeName)
g.Expect(err).ToNot(HaveOccurred())
return utils.TaintExists(node.Spec.Taints, &farTaint)
}, 1*time.Second, "200ms").Should(BeTrue())
}, timeoutTaint, pollTaint).Should(BeTrue())
log.Info("FAR taint was added", "node name", node.Name, "taint key", farTaint.Key, "taint effect", farTaint.Effect)
}

Expand All @@ -313,7 +315,7 @@ func waitForNodeHealthyCondition(node *corev1.Node, condStatus corev1.ConditionS
}
}
return corev1.ConditionStatus("failure")
}, timeoutReboot, pollInterval).Should(Equal(condStatus))
}, timeoutReboot, pollReboot).Should(Equal(condStatus))
}

// makeNodeUnready stops kubelet and wait for the node condition to be not ready unless the node was already unready
Expand Down Expand Up @@ -344,7 +346,7 @@ func wasNodeRebooted(nodeName string, nodeBootTimeBefore time.Time) {
log.Error(errBootAfter, "Can't get boot time of the node")
}
return nodeBootTimeAfter, errBootAfter
}, timeoutReboot, pollInterval).Should(
}, timeoutReboot, pollReboot).Should(
BeTemporally(">", nodeBootTimeBefore), "Timeout for node reboot has passed, even though FAR CR has been created")

log.Info("successful reboot", "node", nodeName, "offset between last boot", nodeBootTimeAfter.Sub(nodeBootTimeBefore), "new boot time", nodeBootTimeAfter)
Expand All @@ -356,7 +358,7 @@ func checkPodDeleted(pod *corev1.Pod) {
newPod := &corev1.Pod{}
err := k8sClient.Get(context.Background(), client.ObjectKeyFromObject(pod), newPod)
return apiErrors.IsNotFound(err)
}, timeoutDeletion, pollDeletion).Should(BeTrue())
}, timeoutAfterReboot, pollAfterReboot).Should(BeTrue())
log.Info("Pod has already been deleted", "pod name", pod.Name)
}

Expand All @@ -373,7 +375,7 @@ func verifyStatusCondition(nodeName, conditionType string, conditionStatus *meta
g.Expect(condition).ToNot(BeNil(), "expected condition %v to be set", conditionType)
g.Expect(condition.Status).To(Equal(*conditionStatus), "expected condition %v to have status %v", conditionType, *conditionStatus)
}
}, timeoutDeletion, pollInterval).Should(Succeed())
}, timeoutAfterReboot, pollAfterReboot).Should(Succeed())
}

// checkRemediation verify whether the node was remediated
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/utils/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func runCommandInCluster(c *kubernetes.Clientset, nodeName string, ns string, co

func waitForPodOutput(c *kubernetes.Clientset, pod *corev1.Pod, command []string) ([]byte, error) {
var out []byte
if err := wait.PollImmediate(15*time.Second, time.Minute, func() (done bool, err error) {
if err := wait.PollImmediate(1*time.Second, time.Minute, func() (done bool, err error) {
out, err = execCommandOnPod(c, pod, command)
if err != nil {
return false, err
Expand Down