Skip to content

Commit

Permalink
Add Event to Player Capacity update (#1497)
Browse files Browse the repository at this point in the history
Looks like I missed this on initial implementation.

Work on #1033

Co-authored-by: Alexander Apalikov <alexander.apalikov@globant.com>
  • Loading branch information
markmandel and aLekSer authored Apr 29, 2020
1 parent 233d0ff commit 387188a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/sdkserver/sdkserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,10 @@ func (s *SDKServer) updatePlayerCapacity() error {
gsCopy.Status.Players.Capacity = s.gsPlayerCapacity
s.gsUpdateMutex.RUnlock()

_, err = s.gameServerGetter.GameServers(s.namespace).Update(gsCopy)
return err
gs, err = s.gameServerGetter.GameServers(s.namespace).Update(gsCopy)
if err != nil {
return err
}
s.recorder.Event(gs, corev1.EventTypeNormal, "PlayerCapacity", fmt.Sprintf("Set to %d", gs.Status.Players.Capacity))
return nil
}
2 changes: 2 additions & 0 deletions pkg/sdkserver/sdkserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,8 @@ func TestSDKServerPlayerCapacity(t *testing.T) {
case <-time.After(time.Minute):
assert.Fail(t, "Should have been updated")
}

agtesting.AssertEventContains(t, m.FakeRecorder.Events, "PlayerCapacity Set to 20")
}

func defaultSidecar(m agtesting.Mocks) (*SDKServer, error) {
Expand Down

0 comments on commit 387188a

Please sign in to comment.