Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
Reverting back changes for earlier trials for fixing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shivaani0505 committed Apr 11, 2023
1 parent 30dfc8e commit d9e1a87
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
23 changes: 17 additions & 6 deletions addons/controllers/clusterbootstrap_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1295,15 +1295,26 @@ var _ = Describe("ClusterBootstrap Reconciler", func() {
if err := k8sClient.Get(ctx, key, config); err != nil {
return false
}
ownerRef := metav1.OwnerReference{
APIVersion: clusterapiv1beta1.GroupVersion.String(),
Kind: "Cluster",
Name: cluster.Name,
UID: cluster.UID,

if len(config.OwnerReferences) > 0 {
return false
}
return clusterapiutil.HasOwnerRef(config.OwnerReferences, ownerRef)

Expect(len(config.OwnerReferences)).Should(Equal(0))
return true
}, waitTimeout, pollingInterval).Should(BeTrue())

patchedSecret := config.DeepCopy()
ownerRef := metav1.OwnerReference{
APIVersion: clusterapiv1beta1.GroupVersion.String(),
Kind: "Cluster",
Name: cluster.Name,
UID: cluster.UID,
}

patchedSecret.OwnerReferences = clusterapiutil.EnsureOwnerRef(patchedSecret.OwnerReferences, ownerRef)
Expect(k8sClient.Patch(ctx, patchedSecret, client.MergeFrom(config))).ShouldNot(HaveOccurred())

Expect(config.ObjectMeta.Labels["tkg.tanzu.vmware.com/package-name"]).Should(Equal("load-balancer-and-ingress-service.tanzu.vmware.com.0.0.4"))

By("ClusterBootstrap CR is created with correct ownerReference added")
Expand Down
11 changes: 11 additions & 0 deletions addons/controllers/testdata/test-cluster-bootstrap-9.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,17 @@ stringData:
identity_management_type: none
tkg_cluster_role: workload
---
apiVersion: v1
kind: Secret
metadata:
name: default-pinniped-config-v1.23.5---vmware.1-tkg.1
namespace: cluster-namespace-9
stringData:
values.yaml: |
infrastructure_provider: vsphere
identity_management_type: none
tkg_cluster_role: workload
---
apiVersion: cni.tanzu.vmware.com/v1alpha1
kind: CalicoConfig
metadata:
Expand Down

0 comments on commit d9e1a87

Please sign in to comment.