mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Fix flaky TestStalePodDisruption
Change-Id: I3394caa54593b7e0206a2872cbdaafddd2fc47f8
This commit is contained in:
parent
9c9b29032f
commit
524daa0a7d
@ -1511,22 +1511,20 @@ func TestStalePodDisruption(t *testing.T) {
|
||||
if _, err := dc.coreClient.CoreV1().Pods(tc.pod.Namespace).Create(ctx, tc.pod, metav1.CreateOptions{}); err != nil {
|
||||
t.Fatalf("Failed to create pod: %v", err)
|
||||
}
|
||||
dc.clock.Sleep(tc.timePassed)
|
||||
if err := dc.informerFactory.Core().V1().Pods().Informer().GetIndexer().Add(tc.pod); err != nil {
|
||||
t.Fatalf("Failed adding pod to indexer: %v", err)
|
||||
}
|
||||
dc.clock.Sleep(tc.timePassed)
|
||||
diff := ""
|
||||
if err := wait.Poll(100*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) {
|
||||
return dc.stalePodDisruptionQueue.Len() == 0, nil
|
||||
pod, err := dc.kubeClient.CoreV1().Pods(tc.pod.Namespace).Get(ctx, tc.pod.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed getting updated pod: %v", err)
|
||||
}
|
||||
diff = cmp.Diff(tc.wantConditions, pod.Status.Conditions, cmpopts.IgnoreFields(v1.PodCondition{}, "LastTransitionTime"))
|
||||
return diff == "", nil
|
||||
}); err != nil {
|
||||
t.Fatalf("Failed waiting for worker to sync: %v", err)
|
||||
}
|
||||
pod, err := dc.kubeClient.CoreV1().Pods(tc.pod.Namespace).Get(ctx, tc.pod.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed getting updated pod: %v", err)
|
||||
}
|
||||
diff := cmp.Diff(tc.wantConditions, pod.Status.Conditions, cmpopts.IgnoreFields(v1.PodCondition{}, "LastTransitionTime"))
|
||||
if diff != "" {
|
||||
t.Errorf("Obtained pod conditions (-want,+got):\n%s", diff)
|
||||
t.Fatalf("Failed waiting for worker to sync: %v, (-want,+got):\n%s", err, diff)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user