Skip to content

Commit

Permalink
Even more debug!
Browse files Browse the repository at this point in the history
  • Loading branch information
markmandel committed Mar 3, 2020
1 parent a65bb72 commit 58a83a6
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/e2e/gameserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,28 @@ func TestGameServerReserve(t *testing.T) {
logger.Info("Received response")
assert.Equal(t, "ACK: RESERVE\n", reply)

gs, err = framework.WaitForGameServerState(readyGs, agonesv1.GameServerStateReserved, time.Minute)
//nolint: gocritic
//gs, err = framework.WaitForGameServerState(readyGs, agonesv1.GameServerStateReserved, time.Minute)
err = wait.PollImmediate(1*time.Second, time.Minute, func() (bool, error) {
var err error
readyGs, err = framework.AgonesClient.AgonesV1().GameServers(readyGs.Namespace).Get(readyGs.Name, metav1.GetOptions{})

if err != nil {
logger.WithError(err).Warn("error retrieving gameserver")
return false, nil
}

logger.WithField("gs", readyGs.ObjectMeta.Name).
WithField("currentState", readyGs.Status.State).Info("Waiting for state to be Reserved")

if readyGs.Status.State == agonesv1.GameServerStateReserved {
return true, nil
}

return false, nil
})
assert.NoError(t, err, fmt.Sprintf("GameServer Name: %s", readyGs.ObjectMeta.Name))
assert.Equal(t, agonesv1.GameServerStateReserved, gs.Status.State, fmt.Sprintf("GameServer Name: %s", readyGs.ObjectMeta.Name))
assert.Equal(t, agonesv1.GameServerStateReserved, readyGs.Status.State, fmt.Sprintf("GameServer Name: %s", readyGs.ObjectMeta.Name))

// it should go back after 10 seconds
gs, err = framework.WaitForGameServerState(readyGs, agonesv1.GameServerStateReady, 15*time.Second)
Expand Down

0 comments on commit 58a83a6

Please sign in to comment.