diff --git a/test/e2e/aks_public_ip_prefix.go b/test/e2e/aks_public_ip_prefix.go index 2878a275110..5258e4ea83f 100644 --- a/test/e2e/aks_public_ip_prefix.go +++ b/test/e2e/aks_public_ip_prefix.go @@ -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", @@ -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{ @@ -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{}