Skip to content

Commit

Permalink
Fix for flaky TestGameServerAllocationMetaDataPatch
Browse files Browse the repository at this point in the history
Cache eventual consistency in the controller means that this test can
be flaky. Implemented a polling request as allocatioon will work
eventually.

Closes #725
  • Loading branch information
markmandel committed Apr 23, 2019
1 parent 6eb3cff commit fb0acfc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/e2e/gameserverallocation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,17 @@ func TestGameServerAllocationMetaDataPatch(t *testing.T) {
},
}}

gsa, err = framework.AgonesClient.AllocationV1alpha1().GameServerAllocations(defaultNs).Create(gsa.DeepCopy())
if assert.Nil(t, err) {
assert.Equal(t, v1alpha1.GameServerAllocationAllocated, gsa.Status.State)
err = wait.PollImmediate(time.Second, 30*time.Second, func() (bool, error) {
gsa, err = framework.AgonesClient.AllocationV1alpha1().GameServerAllocations(defaultNs).Create(gsa.DeepCopy())

if err != nil {
return true, err
}

return v1alpha1.GameServerAllocationAllocated == gsa.Status.State, nil
})
if err != nil {
assert.FailNow(t, err.Error())
}

gs, err = framework.AgonesClient.StableV1alpha1().GameServers(defaultNs).Get(gsa.Status.GameServerName, metav1.GetOptions{})
Expand Down

0 comments on commit fb0acfc

Please sign in to comment.