Skip to content

Commit

Permalink
Attemp#1 at fixing failures
Browse files Browse the repository at this point in the history
Signed-off-by: Parthvi <parthvi.vala@suse.com>
  • Loading branch information
valaparthvi committed May 13, 2024
1 parent d9ee110 commit 796c7c6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
6 changes: 3 additions & 3 deletions hosted/gke/p1/sync/sync_import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ var _ = Describe("SyncImport", func() {
np.Version = &k8sVersion
}
})

cluster, err = gke.CreateGKEHostedCluster(ctx.RancherClient, clusterName, ctx.CloudCred.ID, false, false, false, false, map[string]string{})
cluster, err = helper.ImportGKEHostedCluster(ctx.RancherClient, clusterName, ctx.CloudCred.ID, false, false, false, false, map[string]string{})
Expect(err).To(BeNil())
cluster, err = helpers.WaitUntilClusterIsReady(cluster, ctx.RancherClient)
Expect(err).To(BeNil())
Expect(err).NotTo(HaveOccurred())
// Workaround to add new Nodegroup till https://github.com/rancher/aks-operator/issues/251 is fixed
cluster.GKEConfig = cluster.GKEStatus.UpstreamSpec
})
AfterEach(func() {
if ctx.ClusterCleanup {
Expand Down
23 changes: 16 additions & 7 deletions hosted/gke/p1/sync/sync_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sync_test

import (
"fmt"
"testing"
"time"

Expand Down Expand Up @@ -30,14 +31,19 @@ func TestSync(t *testing.T) {
RunSpecs(t, "Sync Suite")
}

var _ = SynchronizedBeforeSuite(func() []byte {
helpers.CommonSynchronizedBeforeSuite()
return nil
}, func() {
ctx = helpers.CommonBeforeSuite()
})

var _ = BeforeEach(func() {
var err error
ctx = helpers.CommonBeforeSuite(helpers.Provider)
Expect(err).To(BeNil())
clusterName = namegen.AppendRandomString(helpers.ClusterNamePrefix)
k8sVersion, err = helper.GetK8sVersion(ctx.RancherClient, project, ctx.CloudCred.ID, zone, "")
k8sVersion, err = helper.GetK8sVersion(ctx.RancherClient, project, ctx.CloudCred.ID, zone, "", false)
Expect(err).To(BeNil())
GinkgoLogr.Info("Using GKE version: ", k8sVersion)
GinkgoLogr.Info(fmt.Sprintf("Using GKE version %s", k8sVersion))
})

var _ = ReportBeforeEach(func(report SpecReport) {
Expand All @@ -62,7 +68,10 @@ func syncK8sVersionUpgradeCheck(cluster *management.Cluster, client *rancher.Cli
Expect(err).To(BeNil())
cluster, err = helpers.WaitUntilClusterIsReady(cluster, client)
Expect(err).To(BeNil())
Expect(*cluster.GKEConfig.KubernetesVersion).To(Equal(upgradeToVersion))
Eventually(func() bool {
return *cluster.GKEConfig.KubernetesVersion == upgradeToVersion
}, tools.SetTimeout(2*time.Minute), 2*time.Second).Should(BeTrue())
//Expect(*cluster.GKEConfig.KubernetesVersion).To(Equal(upgradeToVersion))
for _, np := range cluster.GKEConfig.NodePools {
Expect(np.Version).To(BeEquivalentTo(currentVersion))
}
Expand Down Expand Up @@ -92,7 +101,7 @@ func syncNodepoolsCheck(cluster *management.Cluster, client *rancher.Client) {
cluster, err = client.Management.Cluster.ByID(cluster.ID)
Expect(err).To(BeNil())
return len(cluster.GKEConfig.NodePools)
}, tools.SetTimeout(2*time.Minute), 2*time.Second).Should(Equal(currentNodeCount + 1))
}, tools.SetTimeout(3*time.Minute), 2*time.Second).Should(Equal(currentNodeCount + 1))
})

By("deleting the nodepool", func() {
Expand All @@ -104,6 +113,6 @@ func syncNodepoolsCheck(cluster *management.Cluster, client *rancher.Client) {
cluster, err = client.Management.Cluster.ByID(cluster.ID)
Expect(err).To(BeNil())
return len(cluster.GKEConfig.NodePools)
}, tools.SetTimeout(2*time.Minute), 2*time.Second).Should(Equal(currentNodeCount))
}, tools.SetTimeout(3*time.Minute), 2*time.Second).Should(Equal(currentNodeCount))
})
}

0 comments on commit 796c7c6

Please sign in to comment.