Fix GC integration test race

During TestCreateWithNonExistentOwner, when creating a pod with a
non-existent owner, assume it's possible the pod will be deleted before
we start checking for the pod's existence. Assuming that the pod still
exists immediately after Create returns is flaky if the GC reacts very
quickly.
This commit is contained in:
Dan Mace 2017-08-21 09:25:50 -04:00
parent f4afdecef8
commit 5334e164c7

View File

@ -418,8 +418,8 @@ func TestCreateWithNonExistentOwner(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("Failed to list pods: %v", err) t.Fatalf("Failed to list pods: %v", err)
} }
if len(pods.Items) != 1 { if len(pods.Items) > 1 {
t.Fatalf("Expect only 1 pod") t.Fatalf("Unexpected pod list: %v", pods.Items)
} }
// wait for the garbage collector to delete the pod // wait for the garbage collector to delete the pod
if err := integration.WaitForPodToDisappear(podClient, garbageCollectedPodName, 5*time.Second, 30*time.Second); err != nil { if err := integration.WaitForPodToDisappear(podClient, garbageCollectedPodName, 5*time.Second, 30*time.Second); err != nil {