@@ -42,7 +42,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
4242 manifests , err := fullRun .Run (nil )
4343 Expect (err ).ToNot (HaveOccurred ())
4444 fullChartInstall , err := os .ReadFile (filepath .Join (customManifestsFolder , "full-chart-install.yaml" ))
45- Expect (manifests ).To (Equal (string (fullChartInstall )))
45+ Expect (manifests ).To (MatchYAML (string (fullChartInstall )))
4646 })
4747
4848 It ("should not deploy providers when none specified" , func () {
@@ -65,7 +65,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
6565 Expect (manifests ).ToNot (BeEmpty ())
6666 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-custom-ns-versions.yaml" ))
6767 Expect (err ).ToNot (HaveOccurred ())
68- Expect (manifests ).To (Equal (string (expectedManifests )))
68+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
6969 })
7070
7171 It ("should deploy all providers with custom versions" , func () {
@@ -82,7 +82,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
8282 Expect (manifests ).ToNot (BeEmpty ())
8383 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-custom-versions.yaml" ))
8484 Expect (err ).ToNot (HaveOccurred ())
85- Expect (manifests ).To (Equal (string (expectedManifests )))
85+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
8686 })
8787
8888 It ("should deploy all providers with latest version" , func () {
@@ -99,7 +99,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
9999 Expect (manifests ).ToNot (BeEmpty ())
100100 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-latest-versions.yaml" ))
101101 Expect (err ).ToNot (HaveOccurred ())
102- Expect (manifests ).To (Equal (string (expectedManifests )))
102+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
103103 })
104104
105105 It ("should deploy core, bootstrap, control plane when only infra is specified" , func () {
@@ -112,7 +112,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
112112 Expect (manifests ).ToNot (BeEmpty ())
113113 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-infra.yaml" ))
114114 Expect (err ).ToNot (HaveOccurred ())
115- Expect (manifests ).To (Equal (string (expectedManifests )))
115+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
116116 })
117117
118118 It ("should deploy core when only bootstrap is specified" , func () {
@@ -125,7 +125,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
125125 Expect (manifests ).ToNot (BeEmpty ())
126126 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-bootstrap.yaml" ))
127127 Expect (err ).ToNot (HaveOccurred ())
128- Expect (manifests ).To (Equal (string (expectedManifests )))
128+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
129129 })
130130
131131 It ("should deploy core when only control plane is specified" , func () {
@@ -138,7 +138,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
138138 Expect (manifests ).ToNot (BeEmpty ())
139139 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-control-plane.yaml" ))
140140 Expect (err ).ToNot (HaveOccurred ())
141- Expect (manifests ).To (Equal (string (expectedManifests )))
141+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
142142 })
143143
144144 It ("should deploy multiple infra providers with custom namespace and versions" , func () {
@@ -151,7 +151,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
151151 Expect (manifests ).ToNot (BeEmpty ())
152152 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "multiple-infra-custom-ns-versions.yaml" ))
153153 Expect (err ).ToNot (HaveOccurred ())
154- Expect (manifests ).To (Equal (string (expectedManifests )))
154+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
155155 })
156156
157157 It ("should deploy multiple control plane providers with custom namespace and versions" , func () {
@@ -164,7 +164,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
164164 Expect (manifests ).ToNot (BeEmpty ())
165165 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "multiple-control-plane-custom-ns-versions.yaml" ))
166166 Expect (err ).ToNot (HaveOccurred ())
167- Expect (manifests ).To (Equal (string (expectedManifests )))
167+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
168168 })
169169
170170 It ("should deploy multiple bootstrap providers with custom namespace and versions" , func () {
@@ -177,7 +177,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
177177 Expect (manifests ).ToNot (BeEmpty ())
178178 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "multiple-bootstrap-custom-ns-versions.yaml" ))
179179 Expect (err ).ToNot (HaveOccurred ())
180- Expect (manifests ).To (Equal (string (expectedManifests )))
180+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
181181 })
182182
183183 It ("should deploy core when only addon is specified" , func () {
@@ -190,7 +190,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
190190 Expect (manifests ).ToNot (BeEmpty ())
191191 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-addon.yaml" ))
192192 Expect (err ).ToNot (HaveOccurred ())
193- Expect (manifests ).To (Equal (string (expectedManifests )))
193+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
194194 })
195195
196196 It ("should deploy core, bootstrap, control plane when only infra and addon is specified" , func () {
@@ -204,7 +204,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
204204 Expect (manifests ).ToNot (BeEmpty ())
205205 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-infra-and-addon.yaml" ))
206206 Expect (err ).ToNot (HaveOccurred ())
207- Expect (manifests ).To (Equal (string (expectedManifests )))
207+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
208208 })
209209 It ("should deploy core and infra with feature gates enabled" , func () {
210210 manifests , err := helmChart .Run (map [string ]string {
@@ -227,6 +227,38 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
227227 Expect (manifests ).ToNot (BeEmpty ())
228228 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "feature-gates.yaml" ))
229229 Expect (err ).ToNot (HaveOccurred ())
230- Expect (manifests ).To (Equal (string (expectedManifests )))
230+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
231+ })
232+ It ("should deploy all providers with manager defined but no feature gates enabled" , func () {
233+ manifests , err := helmChart .Run (map [string ]string {
234+ "configSecret.name" : "test-secret-name" ,
235+ "configSecret.namespace" : "test-secret-namespace" ,
236+ "infrastructure" : "azure" ,
237+ "addon" : "helm" ,
238+ "core" : "cluster-api" ,
239+ "manager.cert-manager.enabled" : "false" ,
240+ "manager.cert-manager.installCRDs" : "false" ,
241+ })
242+ Expect (err ).ToNot (HaveOccurred ())
243+ Expect (manifests ).ToNot (BeEmpty ())
244+ expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-latest-versions.yaml" ))
245+ Expect (err ).ToNot (HaveOccurred ())
246+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
247+ })
248+ It ("should deploy all providers when manager is defined but another infrastructure spec field is defined" , func () {
249+ manifests , err := helmChart .Run (map [string ]string {
250+ "core" : "cluster-api" ,
251+ "controlPlane" : "kubeadm" ,
252+ "bootstrap" : "kubeadm" ,
253+ "infrastructure" : "docker" ,
254+ "addon" : "helm" ,
255+ "manager.featureGates.core.ClusterTopology" : "true" ,
256+ "manager.featureGates.core.MachinePool" : "true" ,
257+ })
258+ Expect (err ).ToNot (HaveOccurred ())
259+ Expect (manifests ).ToNot (BeEmpty ())
260+ expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "manager-defined-missing-other-infra-spec.yaml" ))
261+ Expect (err ).ToNot (HaveOccurred ())
262+ Expect (manifests ).To (MatchYAML (string (expectedManifests )))
231263 })
232264})
0 commit comments