In the `should correctly account for terminated pods after restart`, the test first creates a set of `restartNever` pods, followed by a set of `restartAlways` pods. Both the `restartNever` and `restartAlways` pods request an entire CPU. As a result, the `restartAlways` pods will not be admitted, if the `restartNever` pods did not terminate yet. Depending on the timing/how fast the pods terminate, the test can pass sometimes fail which results in flakes. To de-flake the test, the test should wait until the `restartNever` pods enter a terminal `Succeeded` phase, before creating the `restartAlways` pods. To do this, generalize the function `waitForPods` to accept a pod condition (`testutils.PodRunningReadyOrSucceeded`, or `testutils.PodSucceeded`). Also introduce a new "Succeeded" pod condition, so the test can explicitly wait until the pods enter the Succeeded phase. Signed-off-by: David Porter <david@porter.me>
3.6 KiB
3.6 KiB