From 879ab37169b56fb7ca20f3709b4e7ff96ca553e1 Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Fri, 1 Feb 2019 10:00:36 -0800 Subject: [PATCH 1/3] e2e: improved logging and simplified waiting for fleet conditions --- test/e2e/fleet_test.go | 57 ++++++++++------------------ test/e2e/fleetautoscaler_test.go | 52 ++++++++++--------------- test/e2e/framework/framework.go | 13 +++++-- test/e2e/gameserveralloction_test.go | 19 +++------- 4 files changed, 54 insertions(+), 87 deletions(-) diff --git a/test/e2e/fleet_test.go b/test/e2e/fleet_test.go index 214d5757fd..24cfcd3c82 100644 --- a/test/e2e/fleet_test.go +++ b/test/e2e/fleet_test.go @@ -54,8 +54,7 @@ func TestCreateFleetAndFleetAllocate(t *testing.T) { defer fleets.Delete(flt.ObjectMeta.Name, nil) // nolint:errcheck } - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) fa := &v1alpha1.FleetAllocation{ ObjectMeta: metav1.ObjectMeta{GenerateName: "allocation-", Namespace: defaultNs}, @@ -88,8 +87,7 @@ func TestCreateFullFleetAndCantFleetAllocate(t *testing.T) { defer fleets.Delete(flt.ObjectMeta.Name, nil) // nolint:errcheck } - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) fa := &v1alpha1.FleetAllocation{ ObjectMeta: metav1.ObjectMeta{GenerateName: "allocation-", Namespace: defaultNs}, @@ -104,10 +102,9 @@ func TestCreateFullFleetAndCantFleetAllocate(t *testing.T) { assert.Equal(t, v1alpha1.GameServerStateAllocated, fa2.Status.GameServer.Status.State) } - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.AllocatedReplicas == replicasCount }) - assert.Nil(t, err) fa2, err := framework.AgonesClient.StableV1alpha1().FleetAllocations(defaultNs).Create(fa) assert.NotNil(t, err) @@ -131,16 +128,14 @@ func TestScaleFleetUpAndDownWithFleetAllocation(t *testing.T) { assert.Equal(t, int32(1), flt.Spec.Replicas) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) // scale up flt, err = scaleFleet(flt, 3) assert.Nil(t, err) assert.Equal(t, int32(3), flt.Spec.Replicas) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err) + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) // get an allocation fa := &v1alpha1.FleetAllocation{ @@ -153,28 +148,24 @@ func TestScaleFleetUpAndDownWithFleetAllocation(t *testing.T) { fa, err = alpha1.FleetAllocations(defaultNs).Create(fa) assert.Nil(t, err) assert.Equal(t, v1alpha1.GameServerStateAllocated, fa.Status.GameServer.Status.State) - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.AllocatedReplicas == 1 }) - assert.Nil(t, err) // scale down, with allocation flt, err = scaleFleet(flt, 1) assert.Nil(t, err) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(0)) - assert.Nil(t, err) + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(0)) // delete the allocated GameServer gp := int64(1) err = alpha1.GameServers(defaultNs).Delete(fa.Status.GameServer.ObjectMeta.Name, &metav1.DeleteOptions{GracePeriodSeconds: &gp}) assert.Nil(t, err) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(1)) - assert.Nil(t, err) + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(1)) - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.AllocatedReplicas == 0 }) - assert.Nil(t, err) } func TestScaleFleetUpAndDownWithGameServerAllocation(t *testing.T) { @@ -190,16 +181,14 @@ func TestScaleFleetUpAndDownWithGameServerAllocation(t *testing.T) { assert.Equal(t, int32(1), flt.Spec.Replicas) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) // scale up flt, err = scaleFleet(flt, 3) assert.Nil(t, err) assert.Equal(t, int32(3), flt.Spec.Replicas) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err) + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) // get an allocation gsa := &v1alpha1.GameServerAllocation{ObjectMeta: metav1.ObjectMeta{GenerateName: "allocation-"}, @@ -210,28 +199,24 @@ func TestScaleFleetUpAndDownWithGameServerAllocation(t *testing.T) { gsa, err = alpha1.GameServerAllocations(defaultNs).Create(gsa) assert.Nil(t, err) assert.Equal(t, v1alpha1.GameServerAllocationAllocated, gsa.Status.State) - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.AllocatedReplicas == 1 }) - assert.Nil(t, err) // scale down, with allocation flt, err = scaleFleet(flt, 1) assert.Nil(t, err) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(0)) - assert.Nil(t, err) + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(0)) // delete the allocated GameServer gp := int64(1) err = alpha1.GameServers(defaultNs).Delete(gsa.Status.GameServerName, &metav1.DeleteOptions{GracePeriodSeconds: &gp}) assert.Nil(t, err) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(1)) - assert.Nil(t, err) + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(1)) - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.AllocatedReplicas == 0 }) - assert.Nil(t, err) } func TestFleetUpdates(t *testing.T) { @@ -312,8 +297,7 @@ func TestUpdateGameServerConfigurationInFleet(t *testing.T) { assert.Equal(t, int32(replicasCount), flt.Spec.Replicas) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) // get an allocation gsa := &v1alpha1.GameServerAllocation{ObjectMeta: metav1.ObjectMeta{GenerateName: "allocation-"}, @@ -324,10 +308,9 @@ func TestUpdateGameServerConfigurationInFleet(t *testing.T) { gsa, err = alpha1.GameServerAllocations(defaultNs).Create(gsa) assert.Nil(t, err, "cloud not create gameserver allocation") assert.Equal(t, v1alpha1.GameServerAllocationAllocated, gsa.Status.State) - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.AllocatedReplicas == 1 }) - assert.Nil(t, err, "could not allocate a gameserver") flt, err = framework.AgonesClient.StableV1alpha1().Fleets(defaultNs).Get(flt.Name, metav1.GetOptions{}) assert.Nil(t, err, "could not get fleet") @@ -371,8 +354,7 @@ func TestFleetAllocationDuringGameServerDeletion(t *testing.T) { assert.Equal(t, size, flt.Spec.Replicas) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) var allocs []*v1alpha1.GameServer @@ -502,8 +484,7 @@ func TestGameServerAllocationDuringGameServerDeletion(t *testing.T) { assert.Equal(t, size, flt.Spec.Replicas) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) var allocs []string diff --git a/test/e2e/fleetautoscaler_test.go b/test/e2e/fleetautoscaler_test.go index 1aad87c1b1..b8ffba21eb 100644 --- a/test/e2e/fleetautoscaler_test.go +++ b/test/e2e/fleetautoscaler_test.go @@ -49,8 +49,7 @@ func TestAutoscalerBasicFunctions(t *testing.T) { defer fleets.Delete(flt.ObjectMeta.Name, nil) // nolint:errcheck } - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) fleetautoscalers := alpha1.FleetAutoscalers(defaultNs) fas, err := fleetautoscalers.Create(defaultFleetAutoscaler(flt)) @@ -64,56 +63,49 @@ func TestAutoscalerBasicFunctions(t *testing.T) { // the fleet autoscaler should scale the fleet up now up to BufferSize bufferSize := int32(fas.Spec.Policy.Buffer.BufferSize.IntValue()) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(bufferSize)) - assert.Nil(t, err, "fleet did not sync with autoscaler") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(bufferSize)) // patch the autoscaler to increase MinReplicas and watch the fleet scale up fas, err = patchFleetAutoscaler(fas, intstr.FromInt(int(bufferSize)), bufferSize+2, fas.Spec.Policy.Buffer.MaxReplicas) assert.Nil(t, err, "could not patch fleetautoscaler") bufferSize = int32(fas.Spec.Policy.Buffer.BufferSize.IntValue()) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(bufferSize)) - assert.Nil(t, err, "fleet did not sync with autoscaler") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(bufferSize)) // patch the autoscaler to remove MinReplicas and watch the fleet scale down fas, err = patchFleetAutoscaler(fas, intstr.FromInt(int(bufferSize)), 0, fas.Spec.Policy.Buffer.MaxReplicas) assert.Nil(t, err, "could not patch fleetautoscaler") bufferSize = int32(fas.Spec.Policy.Buffer.BufferSize.IntValue()) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(bufferSize)) - assert.Nil(t, err, "fleet did not sync with autoscaler") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(bufferSize)) // do an allocation and watch the fleet scale up fa := getAllocation(flt) fa, err = alpha1.FleetAllocations(defaultNs).Create(fa) assert.Nil(t, err) assert.Equal(t, v1alpha1.GameServerStateAllocated, fa.Status.GameServer.Status.State) - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.AllocatedReplicas == 1 }) - assert.Nil(t, err) - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(bufferSize)) - assert.Nil(t, err, "fleet did not sync with autoscaler") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(bufferSize)) // patch autoscaler to switch to relative buffer size and check if the fleet adjusts _, err = patchFleetAutoscaler(fas, intstr.FromString("10%"), 1, fas.Spec.Policy.Buffer.MaxReplicas) assert.Nil(t, err, "could not patch fleetautoscaler") //10% with only one allocated GS means only one ready server - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(1)) - assert.Nil(t, err, "fleet did not sync with autoscaler") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(1)) // delete the allocated GameServer and watch the fleet scale down gp := int64(1) err = alpha1.GameServers(defaultNs).Delete(fa.Status.GameServer.ObjectMeta.Name, &metav1.DeleteOptions{GracePeriodSeconds: &gp}) assert.Nil(t, err) - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.AllocatedReplicas == 0 && fleet.Status.ReadyReplicas == 1 && fleet.Status.Replicas == 1 }) - assert.Nil(t, err) } // TestAutoscalerStressCreate creates many fleetautoscalers with random values @@ -129,8 +121,7 @@ func TestAutoscalerStressCreate(t *testing.T) { defer fleets.Delete(flt.ObjectMeta.Name, nil) // nolint:errcheck } - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) r := rand.New(rand.NewSource(1783)) @@ -170,8 +161,7 @@ func TestAutoscalerStressCreate(t *testing.T) { expectedReplicas = fas.Spec.Policy.Buffer.MaxReplicas } // the fleet autoscaler should scale the fleet now to expectedReplicas - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(expectedReplicas)) - assert.Nil(t, err, fmt.Sprintf("fleet did not sync with autoscaler, expected %d ready replicas", expectedReplicas)) + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(expectedReplicas)) } else { assert.False(t, valid, fmt.Sprintf("FleetAutoscaler NOT created even if the parameters are valid: %d %d %d (%s)", @@ -206,7 +196,9 @@ func patchFleetAutoscaler(fas *v1alpha1.FleetAutoscaler, bufferSize intstr.IntOr WithField("patch", patch). Info("Patching fleetautoscaler") - return framework.AgonesClient.StableV1alpha1().FleetAutoscalers(defaultNs).Patch(fas.ObjectMeta.Name, types.JSONPatchType, []byte(patch)) + fas, err := framework.AgonesClient.StableV1alpha1().FleetAutoscalers(defaultNs).Patch(fas.ObjectMeta.Name, types.JSONPatchType, []byte(patch)) + logrus.WithField("fleetautoscaler", fas).Info("Patched fleet autoscaler") + return fas, err } // defaultFleetAutoscaler returns a default fleet autoscaler configuration for a given fleet @@ -269,8 +261,7 @@ func TestAutoscalerWebhook(t *testing.T) { defer fleets.Delete(flt.ObjectMeta.Name, nil) // nolint:errcheck } - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) fleetautoscalers := alpha1.FleetAutoscalers(defaultNs) fas := defaultFleetAutoscaler(flt) @@ -295,15 +286,13 @@ func TestAutoscalerWebhook(t *testing.T) { fa, err = alpha1.FleetAllocations(defaultNs).Create(fa) assert.Nil(t, err) assert.Equal(t, v1alpha1.GameServerStateAllocated, fa.Status.GameServer.Status.State) - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.AllocatedReplicas == 1 }) - assert.Nil(t, err) - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.Replicas > initialReplicasCount }) - assert.Nil(t, err) } var webhookKey = ` @@ -446,8 +435,7 @@ func TestTlsWebhook(t *testing.T) { defer fleets.Delete(flt.ObjectMeta.Name, nil) // nolint:errcheck } - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) fleetautoscalers := alpha1.FleetAutoscalers(defaultNs) fas := defaultFleetAutoscaler(flt) @@ -474,15 +462,13 @@ func TestTlsWebhook(t *testing.T) { fa, err = alpha1.FleetAllocations(defaultNs).Create(fa.DeepCopy()) assert.Nil(t, err) assert.Equal(t, v1alpha1.GameServerStateAllocated, fa.Status.GameServer.Status.State) - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.AllocatedReplicas == 1 }) - assert.Nil(t, err) - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.Replicas > initialReplicasCount }) - assert.Nil(t, err) } func defaultAutoscalerWebhook() (*corev1.Pod, *corev1.Service) { diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index 8caa828375..ce1adff9fc 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -19,6 +19,7 @@ package framework import ( "fmt" "net" + "testing" "time" "agones.dev/agones/pkg/apis/stable/v1alpha1" @@ -122,8 +123,10 @@ func (f *Framework) WaitForGameServerState(gs *v1alpha1.GameServer, state v1alph return readyGs, nil } -// WaitForFleetCondition waits for the Fleet to be in a specific condition -func (f *Framework) WaitForFleetCondition(flt *v1alpha1.Fleet, condition func(fleet *v1alpha1.Fleet) bool) error { +// WaitForFleetCondition waits for the Fleet to be in a specific condition or fails the test if the condition can't be met in 5 minutes. +func (f *Framework) WaitForFleetCondition(t *testing.T, flt *v1alpha1.Fleet, condition func(fleet *v1alpha1.Fleet) bool) { + t.Helper() + logrus.WithField("fleet", flt.Name).Info("waiting for fleet condition") err := wait.PollImmediate(2*time.Second, 5*time.Minute, func() (bool, error) { fleet, err := f.AgonesClient.StableV1alpha1().Fleets(flt.ObjectMeta.Namespace).Get(flt.ObjectMeta.Name, metav1.GetOptions{}) if err != nil { @@ -132,7 +135,10 @@ func (f *Framework) WaitForFleetCondition(flt *v1alpha1.Fleet, condition func(fl return condition(fleet), nil }) - return err + if err != nil { + logrus.WithField("fleet", flt.Name).WithError(err).Info("error waiting for fleet condition") + t.Fatal("error waiting for fleet condition") + } } // ListGameServersFromFleet lists GameServers from a particular fleet @@ -161,6 +167,7 @@ func (f *Framework) ListGameServersFromFleet(flt *v1alpha1.Fleet) ([]v1alpha1.Ga // FleetReadyCount returns the ready count in a fleet func FleetReadyCount(amount int32) func(fleet *v1alpha1.Fleet) bool { return func(fleet *v1alpha1.Fleet) bool { + logrus.Infof("fleet %v has %v/%v ready replicas", fleet.Name, fleet.Status.ReadyReplicas, amount) return fleet.Status.ReadyReplicas == amount } } diff --git a/test/e2e/gameserveralloction_test.go b/test/e2e/gameserveralloction_test.go index 386f047d99..5c309e2ba6 100644 --- a/test/e2e/gameserveralloction_test.go +++ b/test/e2e/gameserveralloction_test.go @@ -41,8 +41,7 @@ func TestCreateFleetAndGameServerAllocate(t *testing.T) { defer fleets.Delete(flt.ObjectMeta.Name, nil) // nolint:errcheck } - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) gsa := &v1alpha1.GameServerAllocation{ObjectMeta: metav1.ObjectMeta{GenerateName: "gsa-"}, Spec: v1alpha1.GameServerAllocationSpec{ @@ -74,8 +73,7 @@ func TestCreateFullFleetAndCantGameServerAllocate(t *testing.T) { defer fleets.Delete(flt.ObjectMeta.Name, nil) // nolint:errcheck } - err = framework.WaitForFleetCondition(flt, e2e.FleetReadyCount(flt.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) gsa := &v1alpha1.GameServerAllocation{ObjectMeta: metav1.ObjectMeta{GenerateName: "allocation-"}, Spec: v1alpha1.GameServerAllocationSpec{ @@ -91,10 +89,9 @@ func TestCreateFullFleetAndCantGameServerAllocate(t *testing.T) { } } - err = framework.WaitForFleetCondition(flt, func(fleet *v1alpha1.Fleet) bool { + framework.WaitForFleetCondition(t, flt, func(fleet *v1alpha1.Fleet) bool { return fleet.Status.AllocatedReplicas == replicasCount }) - assert.Nil(t, err) gsa, err = framework.AgonesClient.StableV1alpha1().GameServerAllocations(defaultNs).Create(gsa.DeepCopy()) if assert.Nil(t, err) { @@ -166,11 +163,8 @@ func TestGameServerAllocationPreferredSelection(t *testing.T) { assert.FailNow(t, "could not create second fleet") } - err = framework.WaitForFleetCondition(preferred, e2e.FleetReadyCount(preferred.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") - - err = framework.WaitForFleetCondition(required, e2e.FleetReadyCount(required.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready") + framework.WaitForFleetCondition(t, preferred, e2e.FleetReadyCount(preferred.Spec.Replicas)) + framework.WaitForFleetCondition(t, required, e2e.FleetReadyCount(required.Spec.Replicas)) gsa := &v1alpha1.GameServerAllocation{ObjectMeta: metav1.ObjectMeta{GenerateName: "allocation-"}, Spec: v1alpha1.GameServerAllocationSpec{ @@ -220,8 +214,7 @@ func TestGameServerAllocationPreferredSelection(t *testing.T) { assert.Nil(t, err) // now wait for another one to come along - err = framework.WaitForFleetCondition(preferred, e2e.FleetReadyCount(preferred.Spec.Replicas)) - assert.Nil(t, err, "fleet not ready, after delete") + framework.WaitForFleetCondition(t, preferred, e2e.FleetReadyCount(preferred.Spec.Replicas)) gsa3, err := framework.AgonesClient.StableV1alpha1().GameServerAllocations(defaultNs).Create(gsa.DeepCopy()) if assert.Nil(t, err) { From 84a281cdad0ab7ba4e6c07d58c7b099661ab9121 Mon Sep 17 00:00:00 2001 From: Mark Mandel Date: Thu, 31 Jan 2019 19:09:19 -0800 Subject: [PATCH 2/3] Typo: Docsy -> Agones Blog. --- site/content/en/blog/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/en/blog/_index.md b/site/content/en/blog/_index.md index 43820eb17d..8c98bdce38 100644 --- a/site/content/en/blog/_index.md +++ b/site/content/en/blog/_index.md @@ -1,5 +1,5 @@ --- -title: "Docsy Blog" +title: "Agones Blog" linkTitle: "Blog" menu: main: From bc75c34329769ed25abf99e7b0cf28b2f11ff219 Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Fri, 1 Feb 2019 15:32:36 -0800 Subject: [PATCH 3/3] e2e: fixed test-only race condition in TestAutoscalerBasicFunctions --- test/e2e/fleetautoscaler_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/fleetautoscaler_test.go b/test/e2e/fleetautoscaler_test.go index b8ffba21eb..530536512a 100644 --- a/test/e2e/fleetautoscaler_test.go +++ b/test/e2e/fleetautoscaler_test.go @@ -69,10 +69,10 @@ func TestAutoscalerBasicFunctions(t *testing.T) { fas, err = patchFleetAutoscaler(fas, intstr.FromInt(int(bufferSize)), bufferSize+2, fas.Spec.Policy.Buffer.MaxReplicas) assert.Nil(t, err, "could not patch fleetautoscaler") - bufferSize = int32(fas.Spec.Policy.Buffer.BufferSize.IntValue()) - framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(bufferSize)) + // min replicas is now higher than buffer size, will scale to that level + framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(fas.Spec.Policy.Buffer.MinReplicas)) - // patch the autoscaler to remove MinReplicas and watch the fleet scale down + // patch the autoscaler to remove MinReplicas and watch the fleet scale down to bufferSize fas, err = patchFleetAutoscaler(fas, intstr.FromInt(int(bufferSize)), 0, fas.Spec.Policy.Buffer.MaxReplicas) assert.Nil(t, err, "could not patch fleetautoscaler")