Skip to content

Commit

Permalink
Restore AMMP-converges-to-failed-ready test spec
Browse files Browse the repository at this point in the history
  • Loading branch information
willie-yao committed Feb 9, 2024
1 parent 38a5395 commit e8eca49
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions test/e2e/aks_public_ip_prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func AKSPublicIPPrefixSpec(ctx context.Context, inputGetter func() AKSPublicIPPr
publicIPPrefix = resp.PublicIPPrefix
}, input.WaitIntervals...).Should(Succeed(), "failed to create public IP prefix")

By("Creating node pool with 2 nodes")
By("Creating node pool with 3 nodes")
infraMachinePool := &infrav1.AzureManagedMachinePool{
ObjectMeta: metav1.ObjectMeta{
Name: "pool3",
Expand All @@ -108,7 +108,7 @@ func AKSPublicIPPrefixSpec(ctx context.Context, inputGetter func() AKSPublicIPPr
},
Spec: expv1.MachinePoolSpec{
ClusterName: input.Cluster.Name,
Replicas: ptr.To[int32](2),
Replicas: ptr.To[int32](3),
Template: clusterv1.MachineTemplateSpec{
Spec: clusterv1.MachineSpec{
Bootstrap: clusterv1.Bootstrap{
Expand Down Expand Up @@ -144,6 +144,27 @@ func AKSPublicIPPrefixSpec(ctx context.Context, inputGetter func() AKSPublicIPPr
}, input.WaitIntervals...).Should(Succeed(), "Deleted AzureManagedMachinePool %s/%s still exists", infraMachinePool.Namespace, infraMachinePool.Name)
}()

By("Verifying the AzureManagedMachinePool converges to a failed ready status")
Eventually(func(g Gomega) {
infraMachinePool := &infrav1.AzureManagedMachinePool{}
err := mgmtClient.Get(ctx, client.ObjectKeyFromObject(machinePool), infraMachinePool)
g.Expect(err).NotTo(HaveOccurred())
cond := conditions.Get(infraMachinePool, infrav1.AgentPoolsReadyCondition)
g.Expect(cond).NotTo(BeNil())
g.Expect(cond.Status).To(Equal(corev1.ConditionFalse))
g.Expect(cond.Reason).To(Equal(infrav1.FailedReason))
g.Expect(cond.Message).To(ContainSubstring("PublicIpPrefixOutOfIpAddressesForVMScaleSet"))
}, input.WaitIntervals...).Should(Succeed())

By("Scaling the MachinePool to 2 nodes")
Eventually(func(g Gomega) {
err = mgmtClient.Get(ctx, client.ObjectKeyFromObject(machinePool), machinePool)
g.Expect(err).NotTo(HaveOccurred())
machinePool.Spec.Replicas = ptr.To[int32](2)
err = mgmtClient.Update(ctx, machinePool)
g.Expect(err).NotTo(HaveOccurred())
}, input.WaitIntervals...).Should(Succeed())

By("Verifying the AzureManagedMachinePool becomes ready")
Eventually(func(g Gomega) {
infraMachinePool := &infrav1.AzureManagedMachinePool{}
Expand Down

0 comments on commit e8eca49

Please sign in to comment.