mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #112610 from alculquicondor/fix-stale-disruption
Fix flaky TestStalePodDisruption
This commit is contained in:
commit
07eb448c82
@ -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