Skip to content

Commit

Permalink
Fix#4
Browse files Browse the repository at this point in the history
Signed-off-by: Parthvi Vala <parthvi.vala@suse.com>
  • Loading branch information
valaparthvi committed Oct 28, 2024
1 parent 09fdef8 commit 85b8015
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions hosted/aks/p1/p1_provisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ var _ = Describe("P1Provisioning", func() {
}()
}
wg.Wait()
// This is to delete the resource group
err := helper.DeleteAKSClusteronAzure(rgName)
Expect(err).To(BeNil())
})
Expand Down
27 changes: 17 additions & 10 deletions hosted/aks/p1/p1_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,14 @@ func invalidateCloudCredentialsCheck(cluster *management.Cluster, client *ranche
Expect(err).To(BeNil())
err = client.Management.CloudCredential.Delete(currentCC)
Expect(err).To(BeNil())

cluster, err = helper.ScaleNodePool(cluster, client, 2, false, false)
const scaleCount int64 = 2
cluster, err = helper.ScaleNodePool(cluster, client, scaleCount, false, false)
Expect(err).To(BeNil())
Eventually(func() bool {
Eventually(func() string {
cluster, err = client.Management.Cluster.ByID(cluster.ID)
Expect(err).NotTo(HaveOccurred())
return cluster.Transitioning == "error"
}, "3m", "2s").Should(BeTrue())
return cluster.Transitioning
}, "3m", "2s").Should(Equal("error"), "Timed out waiting for cluster to transition into error")

// Create new cloud credentials and update the cluster config with it
newCCID, err := helpers.CreateCloudCredentials(client)
Expand All @@ -551,15 +551,21 @@ func invalidateCloudCredentialsCheck(cluster *management.Cluster, client *ranche
cluster, err = helper.UpdateCluster(cluster, client, updateFunc)
Expect(err).To(BeNil())
Expect(cluster.AKSConfig.AzureCredentialSecret).To(Equal(newCCID))
err = clusters.WaitClusterToBeUpgraded(client, cluster.ID)
Expect(err).To(BeNil())
Eventually(func() bool {
cluster, err = client.Management.Cluster.ByID(cluster.ID)
Expect(err).NotTo(HaveOccurred())
return cluster.AKSStatus.UpstreamSpec.AzureCredentialSecret == newCCID
}, "7m", "5s").Should(BeTrue())
}, "5m", "5s").Should(BeTrue())

// Update the cluster again to ensure things are working
cluster, err = helper.ScaleNodePool(cluster, client, 2, true, true)
Expect(err).To(BeNil())
for _, nodepool := range cluster.AKSConfig.NodePools {
Expect(*nodepool.Count).To(Equal(scaleCount))
}

for _, nodepool := range cluster.AKSStatus.UpstreamSpec.NodePools {
Expect(*nodepool.Count).To(Equal(scaleCount))
}

// Update the context so that any future tests are not disrupted
ctx.CloudCredID = newCCID
Expand Down Expand Up @@ -600,7 +606,8 @@ func azureSyncCheck(cluster *management.Cluster, client *rancher.Client, upgrade
npName = "syncnodepool"
nodeCount int64 = 1
)
currentNPCount := len(cluster.AKSConfig.NodePools)
// Using upstreamSpec so that it also works with import tests
currentNPCount := len(cluster.AKSStatus.UpstreamSpec.NodePools)
By("Adding a nodepool", func() {
err := helper.AddNodePoolOnAzure(npName, cluster.AKSConfig.ClusterName, cluster.AKSConfig.ResourceGroup, fmt.Sprint(nodeCount))
Expect(err).To(BeNil())
Expand Down

0 comments on commit 85b8015

Please sign in to comment.