Skip to content

Commit ca6acd4

Browse files
authored
Merge pull request #12100 from sivchari/fix-verify-condition-logic
🐛 Fix the condition to check whether cluster has v1beta2 conditions
2 parents 55f79e4 + 06a1bdf commit ca6acd4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/e2e/clusterctl_upgrade.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ func verifyV1Beta2ConditionsTrueV1Beta1(ctx context.Context, c client.Client, cl
813813
return c.Get(ctx, key, cluster)
814814
}, 3*time.Minute, 3*time.Second).Should(Succeed(), "Failed to get Cluster object %s", klog.KRef(clusterNamespace, clusterName))
815815

816-
if cluster.Status.V1Beta2 != nil && cluster.Status.V1Beta2.Conditions == nil {
816+
if cluster.Status.V1Beta2 != nil && len(cluster.Status.V1Beta2.Conditions) > 0 {
817817
for _, conditionType := range v1beta2conditionTypes {
818818
for _, condition := range cluster.Status.V1Beta2.Conditions {
819819
if condition.Type != conditionType {
@@ -832,8 +832,11 @@ func verifyV1Beta2ConditionsTrueV1Beta1(ctx context.Context, c client.Client, cl
832832
clusterv1.ClusterNameLabel: clusterName,
833833
})
834834
}, 3*time.Minute, 3*time.Second).Should(Succeed(), "Failed to list Machines for Cluster %s", klog.KObj(cluster))
835-
if cluster.Status.V1Beta2 != nil && cluster.Status.V1Beta2.Conditions == nil {
835+
if cluster.Status.V1Beta2 != nil && len(cluster.Status.V1Beta2.Conditions) > 0 {
836836
for _, machine := range machineList.Items {
837+
if machine.Status.V1Beta2 == nil || len(machine.Status.V1Beta2.Conditions) == 0 {
838+
continue
839+
}
837840
for _, conditionType := range v1beta2conditionTypes {
838841
for _, condition := range machine.Status.V1Beta2.Conditions {
839842
if condition.Type != conditionType {

0 commit comments

Comments
 (0)