From ce0523460ac2c94af1633156ab9abc15601da1c5 Mon Sep 17 00:00:00 2001 From: Tanmay Jain Date: Wed, 3 Apr 2024 16:47:25 +0530 Subject: [PATCH] fixing testcases --- api/v1/aerospikecluster_types.go | 8 ++++---- test/cluster_test.go | 17 +++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/api/v1/aerospikecluster_types.go b/api/v1/aerospikecluster_types.go index 19a3ab478..5fa0f1356 100644 --- a/api/v1/aerospikecluster_types.go +++ b/api/v1/aerospikecluster_types.go @@ -996,9 +996,9 @@ func CopySpecToStatus(spec *AerospikeClusterSpec) (*AerospikeClusterStatusSpec, } if len(spec.K8sNodeBlockList) != 0 { - k8sNodeBlockList := lib.DeepCopy(&spec.K8sNodeBlockList).([]string) + k8sNodeBlockList := lib.DeepCopy(&spec.K8sNodeBlockList).(*[]string) - status.K8sNodeBlockList = k8sNodeBlockList + status.K8sNodeBlockList = *k8sNodeBlockList } return &status, nil @@ -1086,8 +1086,8 @@ func CopyStatusToSpec(status *AerospikeClusterStatusSpec) (*AerospikeClusterSpec } if len(status.K8sNodeBlockList) != 0 { - k8sNodeBlockList := lib.DeepCopy(&status.K8sNodeBlockList).([]string) - spec.K8sNodeBlockList = k8sNodeBlockList + k8sNodeBlockList := lib.DeepCopy(&status.K8sNodeBlockList).(*[]string) + spec.K8sNodeBlockList = *k8sNodeBlockList } return &spec, nil diff --git a/test/cluster_test.go b/test/cluster_test.go index a612386e2..2181b058a 100644 --- a/test/cluster_test.go +++ b/test/cluster_test.go @@ -192,14 +192,15 @@ func clusterWithMaxIgnorablePod(ctx goctx.Context) { }, 1*time.Minute).ShouldNot(HaveOccurred()) By("Upgrade version") - aeroCluster, err = getCluster(k8sClient, ctx, clusterNamespacedName) - Expect(err).ToNot(HaveOccurred()) - newImage := baseImage + ":7.0.0.0_2" - aeroCluster.Spec.Image = newImage - // As pod is in pending state, CR object will be won't reach the final phase. - // So expectedPhases can be InProgress or Completed - err = updateClusterWithExpectedPhases(k8sClient, ctx, aeroCluster, expectedPhases) - Expect(err).ToNot(HaveOccurred()) + Eventually(func() error { + aeroCluster, err = getCluster(k8sClient, ctx, clusterNamespacedName) + Expect(err).ToNot(HaveOccurred()) + newImage := baseImage + ":7.0.0.0_2" + aeroCluster.Spec.Image = newImage + // As pod is in pending state, CR object will be won't reach the final phase. + // So expectedPhases can be InProgress or Completed + return updateClusterWithExpectedPhases(k8sClient, ctx, aeroCluster, expectedPhases) + }, 1*time.Minute).ShouldNot(HaveOccurred()) By("Verify pending pod") podList, err = getPodList(aeroCluster, k8sClient)