UPSTREAM: 41634: Handle error event type
@@ -23,6 +23,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
klabels "k8s.io/apimachinery/pkg/labels"
@@ -325,6 +326,10 @@ var _ = framework.KubeDescribe("StatefulSet", func() {
By("Verifying the 2nd pod is removed only when it becomes running and ready")
sst.RestoreProbe(ss, testProbe)
_, err = watch.Until(framework.StatefulSetTimeout, watcher, func(event watch.Event) (bool, error) {
+ if event.Type == watch.Error {
+ framework.Logf("Keep waiting, received error from watch event: %v", kerrors.FromObject(event.Object))
+ return false, nil
+ }
pod := event.Object.(*v1.Pod)
if event.Type == watch.Deleted && pod.Name == expectedPodName {
return false, fmt.Errorf("Pod %v was deleted before enter running", pod.Name)
@@ -467,9 +472,12 @@ var _ = framework.KubeDescribe("StatefulSet", func() {
framework.ExpectNoError(err)
// we need to get UID from pod in any state and wait until stateful set controller will remove pod atleast once
_, err = watch.Until(framework.StatefulPodTimeout, w, func(event watch.Event) (bool, error) {
+ if event.Type == watch.Error {
+ framework.Logf("Keep waiting, received error from watch event: %v", kerrors.FromObject(event.Object))
+ return false, nil
+ }
pod := event.Object.(*v1.Pod)
- switch event.Type {
- case watch.Deleted:
+ if event.Type == watch.Deleted {
framework.Logf("Observed delete event for stateful pod %v in namespace %v", pod.Name, pod.Namespace)
if initialStatefulPodUID == "" {
return false, nil
