Skip to content

Commit

Permalink
Update e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
danieloliveira079 committed May 12, 2022
1 parent 59040f3 commit ef961c0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/e2e/fleet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestFleetScaleUpAllocateEditAndScaleDownToZero(t *testing.T) {

// Scale up to 5 replicas
const targetScale = 5
flt = scaleFleetSubresource(ctx, t, flt, targetScale)
flt = scaleFleetPatch(ctx, t, flt, targetScale)
framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(targetScale))

// Allocate 1 replica
Expand All @@ -163,6 +163,7 @@ func TestFleetScaleUpAllocateEditAndScaleDownToZero(t *testing.T) {
fltCopy.Spec.Template.Spec.Players = &agonesv1.PlayersSpec{InitialCapacity: 4}
flt, err = client.Fleets(framework.Namespace).Update(ctx, fltCopy, metav1.UpdateOptions{})
assert.Nil(t, err)
assert.Equal(t, int64(4), flt.Spec.Template.Spec.Players.InitialCapacity)

// Wait for one more GSSet to be created
err = wait.PollImmediate(1*time.Second, time.Minute, func() (bool, error) {
Expand All @@ -183,7 +184,7 @@ func TestFleetScaleUpAllocateEditAndScaleDownToZero(t *testing.T) {

// Scale down to zero
const scaleDownTarget = 0
flt = scaleFleetSubresource(ctx, t, flt, scaleDownTarget)
flt = scaleFleetPatch(ctx, t, flt, scaleDownTarget)
framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(0))

// Expect Replicas = 0, No GSS or GS
Expand All @@ -192,12 +193,16 @@ func TestFleetScaleUpAllocateEditAndScaleDownToZero(t *testing.T) {
err = client.GameServers(framework.Namespace).Delete(ctx, gsa.Status.GameServerName, metav1.DeleteOptions{GracePeriodSeconds: &gp})
assert.Nil(t, err)

framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(1))
framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(0))

framework.AssertFleetCondition(t, flt, func(log *logrus.Entry, fleet *agonesv1.Fleet) bool {
return fleet.Status.AllocatedReplicas == 0
})

framework.AssertFleetCondition(t, flt, func(log *logrus.Entry, fleet *agonesv1.Fleet) bool {
return fleet.Status.Replicas == 0
})

}

func TestFleetScaleUpEditAndScaleDown(t *testing.T) {
Expand Down

0 comments on commit ef961c0

Please sign in to comment.