Merge pull request #94922 from knabben/pre-stop-e2e

Verify pod termination with E2E PreStop hook
This commit is contained in:
Kubernetes Prow Robot 2020-10-01 16:35:19 -07:00 committed by GitHub
commit 1ec3345eb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,10 +187,11 @@ var _ = SIGDescribe("PreStop", func() {
err = podClient.Delete(context.TODO(), pod.Name, *metav1.NewDeleteOptions(gracefulTerminationPeriodSeconds)) err = podClient.Delete(context.TODO(), pod.Name, *metav1.NewDeleteOptions(gracefulTerminationPeriodSeconds))
framework.ExpectNoError(err, "failed to delete pod") framework.ExpectNoError(err, "failed to delete pod")
//wait up to graceful termination period seconds // wait for less than the gracePeriod termination ensuring the
time.Sleep(30 * time.Second) // preStop hook is still executing.
time.Sleep(15 * time.Second)
ginkgo.By("verifying the pod running state after graceful termination") ginkgo.By("verifying the pod is running while in the graceful period termination")
result := &v1.PodList{} result := &v1.PodList{}
err = wait.Poll(time.Second*5, time.Second*60, func() (bool, error) { err = wait.Poll(time.Second*5, time.Second*60, func() (bool, error) {
client, err := e2ekubelet.ProxyRequest(f.ClientSet, pod.Spec.NodeName, "pods", ports.KubeletPort) client, err := e2ekubelet.ProxyRequest(f.ClientSet, pod.Spec.NodeName, "pods", ports.KubeletPort)