mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
Make the check strict to use ExpectNoError()
As https://github.com/kubernetes/kubernetes/pull/78478 we can use ExpectNoError() instead of Expect(err).ToNot(HaveOccurred()) also. This makes the test code check strict to cover the above case and replaces the remaining in test/e2e/common/expansion.go
This commit is contained in:
parent
0e499be526
commit
d5bc1ae8aa
@ -25,7 +25,7 @@ mapfile -t all_e2e_files < <(find test/e2e -name '*.go' | grep -v 'test/e2e/fram
|
||||
errors_expect_no_error=()
|
||||
for file in "${all_e2e_files[@]}"
|
||||
do
|
||||
if grep "Expect(.*)\.NotTo(.*HaveOccurred()" "${file}" > /dev/null
|
||||
if grep -E "Expect\(.*\)\.(NotTo|ToNot)\(.*HaveOccurred\(\)" "${file}" > /dev/null
|
||||
then
|
||||
errors_expect_no_error+=( "${file}" )
|
||||
fi
|
||||
|
@ -286,7 +286,7 @@ var _ = framework.KubeDescribe("Pods", func() {
|
||||
framework.ExpectNoError(err, "failed to delete pod")
|
||||
|
||||
ginkgo.By("verifying the kubelet observed the termination notice")
|
||||
gomega.Expect(wait.Poll(time.Second*5, time.Second*30, func() (bool, error) {
|
||||
err = wait.Poll(time.Second*5, time.Second*30, func() (bool, error) {
|
||||
podList, err := framework.GetKubeletPods(f.ClientSet, pod.Spec.NodeName)
|
||||
if err != nil {
|
||||
e2elog.Logf("Unable to retrieve kubelet pods for node %v: %v", pod.Spec.NodeName, err)
|
||||
@ -304,7 +304,8 @@ var _ = framework.KubeDescribe("Pods", func() {
|
||||
}
|
||||
e2elog.Logf("no pod exists with the name we were looking for, assuming the termination request was observed and completed")
|
||||
return true, nil
|
||||
})).NotTo(gomega.HaveOccurred(), "kubelet never observed the termination notice")
|
||||
})
|
||||
framework.ExpectNoError(err, "kubelet never observed the termination notice")
|
||||
|
||||
ginkgo.By("verifying pod deletion was observed")
|
||||
deleted := false
|
||||
|
@ -270,8 +270,9 @@ func deletePodsSync(f *framework.Framework, pods []*v1.Pod) {
|
||||
err := f.PodClient().Delete(pod.ObjectMeta.Name, metav1.NewDeleteOptions(30))
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
gomega.Expect(e2epod.WaitForPodToDisappear(f.ClientSet, f.Namespace.Name, pod.ObjectMeta.Name, labels.Everything(),
|
||||
30*time.Second, 10*time.Minute)).NotTo(gomega.HaveOccurred())
|
||||
err = e2epod.WaitForPodToDisappear(f.ClientSet, f.Namespace.Name, pod.ObjectMeta.Name, labels.Everything(),
|
||||
30*time.Second, 10*time.Minute)
|
||||
framework.ExpectNoError(err)
|
||||
}(pod)
|
||||
}
|
||||
wg.Wait()
|
||||
|
Loading…
Reference in New Issue
Block a user