Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better e2e udp send errors #2349

Merged
merged 1 commit into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
}
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/gameserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down