Skip to content

Commit

Permalink
Updates from review.
Browse files Browse the repository at this point in the history
  • Loading branch information
markmandel committed May 14, 2020
1 parent ea373ed commit d3b5c75
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions examples/simple-udp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ func getPlayerCapacity(s *sdk.SDK) string {
if err != nil {
log.Fatalf("could not get capacity: %v", err)
}
return strconv.FormatInt(capacity, 10)
return strconv.FormatInt(capacity, 10) + "\n"
}

// playerConnect connects a given player
Expand Down Expand Up @@ -373,7 +373,7 @@ func playerIsConnected(s *sdk.SDK, id string) string {
log.Fatalf("could not retrieve if player is connected: %v", err)
}

return strconv.FormatBool(connected)
return strconv.FormatBool(connected) + "\n"
}

// getConnectedPlayers returns a comma delimeted list of connected players
Expand All @@ -384,7 +384,7 @@ func getConnectedPlayers(s *sdk.SDK) string {
log.Fatalf("could not retrieve connected players: %s", err)
}

return strings.Join(list, ",")
return strings.Join(list, ",") + "\n"
}

// getPlayerCount returns the count of connected players as a string
Expand All @@ -394,7 +394,7 @@ func getPlayerCount(s *sdk.SDK) string {
if err != nil {
log.Fatalf("could not retrieve player count: %s", err)
}
return strconv.FormatInt(count, 10)
return strconv.FormatInt(count, 10) + "\n"
}

// doHealth sends the regular Health Pings
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func NewFromFlags() (*Framework, error) {
}

viper.SetDefault(kubeconfigFlag, filepath.Join(usr.HomeDir, "/.kube/config"))
viper.SetDefault(gsimageFlag, "gcr.io/agones-images/udp-server:0.20")
viper.SetDefault(gsimageFlag, "gcr.io/agones-images/udp-server:0.19")
viper.SetDefault(pullSecretFlag, "")
viper.SetDefault(stressTestLevelFlag, 0)
viper.SetDefault(perfOutputDirFlag, "")
Expand Down
20 changes: 10 additions & 10 deletions test/e2e/gameserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ func TestGameServerSetPlayerCapacity(t *testing.T) {

reply, err := e2eframework.SendGameServerUDP(gs, "PLAYER_CAPACITY")
assert.NoError(t, err)
assert.Equal(t, "0", reply)
assert.Equal(t, "0\n", reply)

reply, err = e2eframework.SendGameServerUDP(gs, "PLAYER_CAPACITY 20")
if err != nil {
Expand All @@ -764,7 +764,7 @@ func TestGameServerSetPlayerCapacity(t *testing.T) {

reply, err = e2eframework.SendGameServerUDP(gs, "PLAYER_CAPACITY")
assert.NoError(t, err)
assert.Equal(t, "20", reply)
assert.Equal(t, "20\n", reply)

err = wait.PollImmediate(time.Second, time.Minute, func() (bool, error) {
gs, err := framework.AgonesClient.AgonesV1().GameServers(defaultNs).Get(gs.ObjectMeta.Name, metav1.GetOptions{})
Expand All @@ -788,7 +788,7 @@ func TestGameServerSetPlayerCapacity(t *testing.T) {

reply, err := e2eframework.SendGameServerUDP(gs, "PLAYER_CAPACITY")
assert.NoError(t, err)
assert.Equal(t, "10", reply)
assert.Equal(t, "10\n", reply)

reply, err = e2eframework.SendGameServerUDP(gs, "PLAYER_CAPACITY 20")
if err != nil {
Expand All @@ -798,7 +798,7 @@ func TestGameServerSetPlayerCapacity(t *testing.T) {

reply, err = e2eframework.SendGameServerUDP(gs, "PLAYER_CAPACITY")
assert.NoError(t, err)
assert.Equal(t, "20", reply)
assert.Equal(t, "20\n", reply)

err = wait.PollImmediate(time.Second, time.Minute, func() (bool, error) {
gs, err := framework.AgonesClient.AgonesV1().GameServers(defaultNs).Get(gs.ObjectMeta.Name, metav1.GetOptions{})
Expand Down Expand Up @@ -844,15 +844,15 @@ func TestPlayerConnectAndDisconnect(t *testing.T) {
// results before it is committed to the GameServer resource.
reply, err := e2eframework.SendGameServerUDP(gs, "PLAYER_CONNECTED 1")
assert.NoError(t, err)
assert.Equal(t, "true", reply)
assert.Equal(t, "true\n", reply)

reply, err = e2eframework.SendGameServerUDP(gs, "GET_PLAYERS")
assert.NoError(t, err)
assert.ElementsMatch(t, []string{"1", "2", "3"}, strings.Split(reply, ","))
assert.ElementsMatch(t, []string{"1", "2", "3"}, strings.Split(strings.TrimSpace(reply), ","))

reply, err = e2eframework.SendGameServerUDP(gs, "PLAYER_COUNT")
assert.NoError(t, err)
assert.Equal(t, "3", reply)
assert.Equal(t, "3\n", reply)

err = wait.Poll(time.Second, time.Minute, func() (bool, error) {
gs, err = framework.AgonesClient.AgonesV1().GameServers(defaultNs).Get(gs.ObjectMeta.Name, metav1.GetOptions{})
Expand All @@ -874,15 +874,15 @@ func TestPlayerConnectAndDisconnect(t *testing.T) {

reply, err = e2eframework.SendGameServerUDP(gs, "PLAYER_CONNECTED 2")
assert.NoError(t, err)
assert.Equal(t, "false", reply)
assert.Equal(t, "false\n", reply)

reply, err = e2eframework.SendGameServerUDP(gs, "GET_PLAYERS")
assert.NoError(t, err)
assert.ElementsMatch(t, []string{"1", "3"}, strings.Split(reply, ","))
assert.ElementsMatch(t, []string{"1", "3"}, strings.Split(strings.TrimSpace(reply), ","))

reply, err = e2eframework.SendGameServerUDP(gs, "PLAYER_COUNT")
assert.NoError(t, err)
assert.Equal(t, "2", reply)
assert.Equal(t, "2\n", reply)

err = wait.Poll(time.Second, time.Minute, func() (bool, error) {
gs, err = framework.AgonesClient.AgonesV1().GameServers(defaultNs).Get(gs.ObjectMeta.Name, metav1.GetOptions{})
Expand Down

0 comments on commit d3b5c75

Please sign in to comment.