Merge pull request #108892 from mkimuram/issue/108891

e2e: deflake "should run through the lifecycle of Pods and PodStatus"
This commit is contained in:
Kubernetes Prow Robot 2022-03-24 22:08:01 -07:00 committed by GitHub
commit cee5e9f406
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,6 +32,7 @@ import (
"golang.org/x/net/websocket"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
@ -948,10 +949,11 @@ var _ = SIGDescribe("Pods", func() {
return false, nil
})
if err != nil {
p, _ := f.ClientSet.CoreV1().Pods(testNamespaceName).Get(context.TODO(), testPodName, metav1.GetOptions{})
framework.Logf("Pod: %+v", p)
framework.Logf("failed to see event that pod is created: %v", err)
}
framework.ExpectNoError(err, "failed to see Pod %v in namespace %v running", testPod.ObjectMeta.Name, testNamespaceName)
p, err := f.ClientSet.CoreV1().Pods(testNamespaceName).Get(context.TODO(), testPodName, metav1.GetOptions{})
framework.ExpectNoError(err, "failed to get Pod %v in namespace %v", testPodName, testNamespaceName)
framework.ExpectEqual(p.Status.Phase, v1.PodRunning, "failed to see Pod %v in namespace %v running", p.ObjectMeta.Name, testNamespaceName)
ginkgo.By("patching the Pod with a new Label and updated data")
podPatch, err := json.Marshal(v1.Pod{
@ -984,7 +986,9 @@ var _ = SIGDescribe("Pods", func() {
}
return false, nil
})
framework.ExpectNoError(err, "failed to see %v event", watch.Modified)
if err != nil {
framework.Logf("failed to see %v event: %v", watch.Modified, err)
}
ginkgo.By("getting the Pod and ensuring that it's patched")
pod, err := f.ClientSet.CoreV1().Pods(testNamespaceName).Get(context.TODO(), testPodName, metav1.GetOptions{})
@ -1048,7 +1052,12 @@ var _ = SIGDescribe("Pods", func() {
}
return false, nil
})
framework.ExpectNoError(err, "failed to see %v event", watch.Deleted)
if err != nil {
framework.Logf("failed to see %v event: %v", watch.Deleted, err)
}
_, err = f.ClientSet.CoreV1().Pods(testNamespaceName).Get(context.TODO(), testPodName, metav1.GetOptions{})
framework.ExpectError(err, "pod %v found in namespace %v, but it should be deleted", testPodName, testNamespaceName)
framework.ExpectEqual(apierrors.IsNotFound(err), true, fmt.Sprintf("expected IsNotFound error, got %#v", err))
})
})