From 86be4de5304697af721ba92918b374b751101c3a Mon Sep 17 00:00:00 2001 From: Mark Mandel Date: Fri, 29 Oct 2021 11:44:10 -0700 Subject: [PATCH] Better e2e udp send errors (#2349) Returning more descriptive error messages on `SendUDP` so we can see what is happening there a bit better. Also cleaned up a small thing left behind in the gameserver e2e tests. --- test/e2e/framework/framework.go | 11 +++++++---- test/e2e/gameserver_test.go | 2 -- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index 2a4e7ae88e..dee4518808 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -501,7 +501,7 @@ func SendGameServerUDPToPort(gs *agonesv1.GameServer, portName string, msg strin func SendUDP(address, msg string) (string, error) { conn, err := net.Dial("udp", address) if err != nil { - return "", err + return "", errors.Wrap(err, "could not dial GameServer address") } defer func() { err = conn.Close() @@ -511,20 +511,23 @@ func SendUDP(address, msg string) (string, error) { err = wait.PollImmediate(time.Second, 5*time.Second, func() (bool, error) { _, err := conn.Write([]byte(msg)) if err != nil { - logrus.WithError(err).Error("Could not write message") + logrus.WithError(err).Error("could not write message to GameServer") } return err == nil, nil }) + if err != nil { + return "", errors.Wrap(err, "could not send message to GameServer after retries") + } b := make([]byte, 1024) err = conn.SetReadDeadline(time.Now().Add(30 * time.Second)) if err != nil { - return "", err + return "", errors.Wrap(err, "could not set read deadline") } n, err := conn.Read(b) if err != nil { - return "", err + return "", errors.Wrap(err, "could not read response from the GameServer") } return string(b[:n]), nil } diff --git a/test/e2e/gameserver_test.go b/test/e2e/gameserver_test.go index d24c2026e3..d1f6c0b396 100644 --- a/test/e2e/gameserver_test.go +++ b/test/e2e/gameserver_test.go @@ -521,8 +521,6 @@ func TestGameServerReadyAllocateReady(t *testing.T) { gs, err = framework.WaitForGameServerState(t, gs, agonesv1.GameServerStateReady, time.Minute) require.NoError(t, err) require.Equal(t, agonesv1.GameServerStateReady, gs.Status.State) - - framework.LogEvents(t, logrus.WithField("gs", gs.ObjectMeta.Name), gs) } func TestGameServerWithPortsMappedToMultipleContainers(t *testing.T) {