From 931645ffb71c68fd24ce4f5301278fd9d750d9bc Mon Sep 17 00:00:00 2001 From: Matt Boersma Date: Tue, 14 Nov 2023 13:02:37 -0700 Subject: [PATCH] wait for provisioning state in AKS e2e tests --- test/e2e/aks_autoscaler.go | 2 ++ test/e2e/aks_azure_cluster_autoscaler.go | 2 ++ test/e2e/aks_node_labels.go | 1 + test/e2e/aks_node_taints.go | 2 ++ test/e2e/aks_tags.go | 3 +++ test/e2e/aks_upgrade.go | 2 ++ 6 files changed, 12 insertions(+) diff --git a/test/e2e/aks_autoscaler.go b/test/e2e/aks_autoscaler.go index 88d5118ab08..bb621c08ea3 100644 --- a/test/e2e/aks_autoscaler.go +++ b/test/e2e/aks_autoscaler.go @@ -114,6 +114,7 @@ func validateAKSAutoscaleDisabled(agentPoolGetter func() (containerservice.Agent Eventually(func(g Gomega) { agentpool, err := agentPoolGetter() g.Expect(err).NotTo(HaveOccurred()) + g.Expect(agentpool.ProvisioningState).To(Equal(pointer.String("Succeeded"))) g.Expect(pointer.BoolDeref(agentpool.EnableAutoScaling, false)).To(BeFalse()) }, inputGetter().WaitIntervals...).Should(Succeed()) } @@ -123,6 +124,7 @@ func validateAKSAutoscaleEnabled(agentPoolGetter func() (containerservice.AgentP Eventually(func(g Gomega) { agentpool, err := agentPoolGetter() g.Expect(err).NotTo(HaveOccurred()) + g.Expect(agentpool.ProvisioningState).To(Equal(pointer.String("Succeeded"))) g.Expect(pointer.BoolDeref(agentpool.EnableAutoScaling, false)).To(BeTrue()) }, inputGetter().WaitIntervals...).Should(Succeed()) } diff --git a/test/e2e/aks_azure_cluster_autoscaler.go b/test/e2e/aks_azure_cluster_autoscaler.go index 3182474029a..4cc68e6c9e6 100644 --- a/test/e2e/aks_azure_cluster_autoscaler.go +++ b/test/e2e/aks_azure_cluster_autoscaler.go @@ -64,6 +64,7 @@ func AKSAzureClusterAutoscalerSettingsSpec(ctx context.Context, inputGetter func aks, err := containerserviceClient.Get(ctx, amcp.Spec.ResourceGroupName, amcp.Name) g.Expect(err).NotTo(HaveOccurred()) + g.Expect(aks.ProvisioningState).To(Equal(pointer.String("Succeeded"))) aksInitialAutoScalerProfile := aks.AutoScalerProfile // Conditional is based off of the actual AKS settings not the AzureManagedControlPlane @@ -109,6 +110,7 @@ func AKSAzureClusterAutoscalerSettingsSpec(ctx context.Context, inputGetter func // Check that the autoscaler settings have been sync'd to AKS aks, err := containerserviceClient.Get(ctx, amcp.Spec.ResourceGroupName, amcp.Name) g.Expect(err).NotTo(HaveOccurred()) + g.Expect(aks.ProvisioningState).To(Equal(pointer.String("Succeeded"))) g.Expect(aks.AutoScalerProfile).ToNot(BeNil()) g.Expect(aks.AutoScalerProfile.Expander).To(Equal(expectedAksExpander)) }, input.WaitIntervals...).Should(Succeed()) diff --git a/test/e2e/aks_node_labels.go b/test/e2e/aks_node_labels.go index dbf14fe1095..b3c9b27e88b 100644 --- a/test/e2e/aks_node_labels.go +++ b/test/e2e/aks_node_labels.go @@ -81,6 +81,7 @@ func AKSNodeLabelsSpec(ctx context.Context, inputGetter func() AKSNodeLabelsSpec checkLabels := func(g Gomega) { agentpool, err := agentpoolsClient.Get(ctx, infraControlPlane.Spec.ResourceGroupName, infraControlPlane.Name, *ammp.Spec.Name) g.Expect(err).NotTo(HaveOccurred()) + g.Expect(agentpool.ProvisioningState).To(Equal(pointer.String("Succeeded"))) var actualLabels map[string]string if agentpool.NodeLabels != nil { diff --git a/test/e2e/aks_node_taints.go b/test/e2e/aks_node_taints.go index 31073cb9621..e76659cd66d 100644 --- a/test/e2e/aks_node_taints.go +++ b/test/e2e/aks_node_taints.go @@ -30,6 +30,7 @@ import ( . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1" @@ -92,6 +93,7 @@ func AKSNodeTaintsSpec(ctx context.Context, inputGetter func() AKSNodeTaintsSpec agentpool, err := agentpoolsClient.Get(ctx, infraControlPlane.Spec.ResourceGroupName, infraControlPlane.Name, *ammp.Spec.Name) g.Expect(err).NotTo(HaveOccurred()) + g.Expect(agentpool.ProvisioningState).To(Equal(pointer.String("Succeeded"))) actualTaintStrs := agentpool.NodeTaints if expectedTaintStrs == nil { g.Expect(actualTaintStrs).To(BeNil()) diff --git a/test/e2e/aks_tags.go b/test/e2e/aks_tags.go index 2f0020e65d7..f2839a3f421 100644 --- a/test/e2e/aks_tags.go +++ b/test/e2e/aks_tags.go @@ -28,6 +28,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" "sigs.k8s.io/cluster-api-provider-azure/azure/converters" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -86,6 +87,7 @@ func AKSAdditionalTagsSpec(ctx context.Context, inputGetter func() AKSAdditional checkTags := func(g Gomega) { managedcluster, err := managedclustersClient.Get(ctx, infraControlPlane.Spec.ResourceGroupName, infraControlPlane.Name) g.Expect(err).NotTo(HaveOccurred()) + g.Expect(managedcluster.ProvisioningState).To(Equal(pointer.String("Succeeded"))) actualTags := converters.MapToTags(managedcluster.Tags) // Ignore tags not originally specified in spec.additionalTags for k := range nonAdditionalTagKeys { @@ -170,6 +172,7 @@ func AKSAdditionalTagsSpec(ctx context.Context, inputGetter func() AKSAdditional checkTags := func(g Gomega) { agentpool, err := agentpoolsClient.Get(ctx, infraControlPlane.Spec.ResourceGroupName, infraControlPlane.Name, *ammp.Spec.Name) g.Expect(err).NotTo(HaveOccurred()) + g.Expect(agentpool.ProvisioningState).To(Equal(pointer.String("Succeeded"))) actualTags := converters.MapToTags(agentpool.Tags) // Ignore tags not originally specified in spec.additionalTags for k := range nonAdditionalTagKeys { diff --git a/test/e2e/aks_upgrade.go b/test/e2e/aks_upgrade.go index 8b3678dc56b..bd55cb9d59d 100644 --- a/test/e2e/aks_upgrade.go +++ b/test/e2e/aks_upgrade.go @@ -26,6 +26,7 @@ import ( "github.com/Azure/go-autorest/autorest/azure/auth" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" azureutil "sigs.k8s.io/cluster-api-provider-azure/util/azure" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -69,6 +70,7 @@ func AKSUpgradeSpec(ctx context.Context, inputGetter func() AKSUpgradeSpecInput) Eventually(func(g Gomega) { aksCluster, err := managedClustersClient.Get(ctx, infraControlPlane.Spec.ResourceGroupName, infraControlPlane.Name) g.Expect(err).NotTo(HaveOccurred()) + g.Expect(aksCluster.ProvisioningState).To(Equal(pointer.String("Succeeded"))) g.Expect(aksCluster.ManagedClusterProperties).NotTo(BeNil()) g.Expect(aksCluster.ManagedClusterProperties.KubernetesVersion).NotTo(BeNil()) g.Expect("v" + *aksCluster.KubernetesVersion).To(Equal(input.KubernetesVersionUpgradeTo))