From 5334e164c742088adada5c375e9c44fb1f3ee29d Mon Sep 17 00:00:00 2001 From: Dan Mace Date: Mon, 21 Aug 2017 09:25:50 -0400 Subject: [PATCH] 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. --- test/integration/garbagecollector/garbage_collector_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/garbagecollector/garbage_collector_test.go b/test/integration/garbagecollector/garbage_collector_test.go index c0c7c2521b4..e54b8170a90 100644 --- a/test/integration/garbagecollector/garbage_collector_test.go +++ b/test/integration/garbagecollector/garbage_collector_test.go @@ -418,8 +418,8 @@ func TestCreateWithNonExistentOwner(t *testing.T) { if err != nil { t.Fatalf("Failed to list pods: %v", err) } - if len(pods.Items) != 1 { - t.Fatalf("Expect only 1 pod") + if len(pods.Items) > 1 { + t.Fatalf("Unexpected pod list: %v", pods.Items) } // wait for the garbage collector to delete the pod if err := integration.WaitForPodToDisappear(podClient, garbageCollectedPodName, 5*time.Second, 30*time.Second); err != nil {