Merge pull request #78740 from oomichi/extend-check

Make the check strict to use ExpectNoError()
This commit is contained in:
Kubernetes Prow Robot 2019-07-30 01:59:04 -07:00 committed by GitHub
commit 614aab80f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -27,7 +27,7 @@ kube::util::read-array all_e2e_files < <(find test/e2e{,_node,_kubeadm} -name '*
errors_expect_no_error=() errors_expect_no_error=()
for file in "${all_e2e_files[@]}" for file in "${all_e2e_files[@]}"
do do
if grep "Expect(.*)\.NotTo(.*HaveOccurred()" "${file}" > /dev/null if grep -E "Expect\(.*\)\.(NotTo|ToNot)\(.*HaveOccurred\(\)" "${file}" > /dev/null
then then
errors_expect_no_error+=( "${file}" ) errors_expect_no_error+=( "${file}" )
fi fi

View File

@ -286,7 +286,7 @@ var _ = framework.KubeDescribe("Pods", func() {
framework.ExpectNoError(err, "failed to delete pod") framework.ExpectNoError(err, "failed to delete pod")
ginkgo.By("verifying the kubelet observed the termination notice") 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) podList, err := framework.GetKubeletPods(f.ClientSet, pod.Spec.NodeName)
if err != nil { if err != nil {
e2elog.Logf("Unable to retrieve kubelet pods for node %v: %v", pod.Spec.NodeName, err) 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") e2elog.Logf("no pod exists with the name we were looking for, assuming the termination request was observed and completed")
return true, nil 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") ginkgo.By("verifying pod deletion was observed")
deleted := false deleted := false

View File

@ -273,8 +273,9 @@ func deletePodsSync(f *framework.Framework, pods []*v1.Pod) {
err := f.PodClient().Delete(pod.ObjectMeta.Name, metav1.NewDeleteOptions(30)) err := f.PodClient().Delete(pod.ObjectMeta.Name, metav1.NewDeleteOptions(30))
framework.ExpectNoError(err) framework.ExpectNoError(err)
gomega.Expect(e2epod.WaitForPodToDisappear(f.ClientSet, f.Namespace.Name, pod.ObjectMeta.Name, labels.Everything(), err = e2epod.WaitForPodToDisappear(f.ClientSet, f.Namespace.Name, pod.ObjectMeta.Name, labels.Everything(),
30*time.Second, 10*time.Minute)).NotTo(gomega.HaveOccurred()) 30*time.Second, 10*time.Minute)
framework.ExpectNoError(err)
}(pod) }(pod)
} }
wg.Wait() wg.Wait()