Merge pull request #51028 from ironcladlou/gc-int-flake

Automatic merge from submit-queue (batch tested with PRs 50967, 50505, 50706, 51033, 51028)

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.

```release-note
NONE
```

Might fix https://github.com/kubernetes/kubernetes/issues/50943; without the additional test context provided by this PR, it's not entirely possible to assess the root cause of the reported failure (as we don't know whether the original assertion failure was due to there being 0 or >1 pods).

/cc @caesarxuchao
This commit is contained in:
Kubernetes Submit Queue 2017-08-22 10:48:26 -07:00 committed by GitHub
commit 622bc55598

View File

@ -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 {