@@ -21,6 +21,7 @@ package e2e
2121import (
2222 "os"
2323 "path/filepath"
24+ "strings"
2425
2526 . "github.com/onsi/ginkgo/v2"
2627 . "github.com/onsi/gomega"
@@ -143,7 +144,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
143144 Expect (err ).ToNot (HaveOccurred ())
144145 fullChartInstall , err := os .ReadFile (filepath .Join (customManifestsFolder , "full-chart-install.yaml" ))
145146 Expect (err ).ToNot (HaveOccurred ())
146- Expect (manifests ).To (Equal (string (fullChartInstall )))
147+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (fullChartInstall ) )))
147148 })
148149
149150 It ("should not deploy providers when none specified" , func () {
@@ -173,7 +174,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
173174 Expect (manifests ).ToNot (BeEmpty ())
174175 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-custom-ns-versions.yaml" ))
175176 Expect (err ).ToNot (HaveOccurred ())
176- Expect (manifests ).To (Equal (string (expectedManifests )))
177+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
177178 })
178179
179180 It ("should deploy all providers with custom versions" , func () {
@@ -191,7 +192,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
191192 Expect (manifests ).ToNot (BeEmpty ())
192193 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-custom-versions.yaml" ))
193194 Expect (err ).ToNot (HaveOccurred ())
194- Expect (manifests ).To (Equal (string (expectedManifests )))
195+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
195196 })
196197
197198 It ("should deploy all providers with latest version" , func () {
@@ -209,7 +210,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
209210 Expect (manifests ).ToNot (BeEmpty ())
210211 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-latest-versions.yaml" ))
211212 Expect (err ).ToNot (HaveOccurred ())
212- Expect (manifests ).To (Equal (string (expectedManifests )))
213+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
213214 })
214215
215216 It ("should deploy core, bootstrap, control plane when only infra is specified" , func () {
@@ -222,7 +223,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
222223 Expect (manifests ).ToNot (BeEmpty ())
223224 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-infra.yaml" ))
224225 Expect (err ).ToNot (HaveOccurred ())
225- Expect (manifests ).To (Equal (string (expectedManifests )))
226+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
226227 })
227228
228229 It ("should deploy core when only bootstrap is specified" , func () {
@@ -235,7 +236,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
235236 Expect (manifests ).ToNot (BeEmpty ())
236237 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-bootstrap.yaml" ))
237238 Expect (err ).ToNot (HaveOccurred ())
238- Expect (manifests ).To (Equal (string (expectedManifests )))
239+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
239240 })
240241
241242 It ("should deploy core when only control plane is specified" , func () {
@@ -248,7 +249,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
248249 Expect (manifests ).ToNot (BeEmpty ())
249250 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-control-plane.yaml" ))
250251 Expect (err ).ToNot (HaveOccurred ())
251- Expect (manifests ).To (Equal (string (expectedManifests )))
252+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
252253 })
253254
254255 It ("should deploy core when only ipam is specified" , func () {
@@ -261,7 +262,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
261262 Expect (manifests ).ToNot (BeEmpty ())
262263 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-ipam.yaml" ))
263264 Expect (err ).ToNot (HaveOccurred ())
264- Expect (manifests ).To (Equal (string (expectedManifests )))
265+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
265266 })
266267
267268 It ("should deploy core, bootstrap, control plane when only infra and ipam is specified" , func () {
@@ -275,7 +276,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
275276 Expect (manifests ).ToNot (BeEmpty ())
276277 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-infra-and-ipam.yaml" ))
277278 Expect (err ).ToNot (HaveOccurred ())
278- Expect (manifests ).To (Equal (string (expectedManifests )))
279+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
279280 })
280281
281282 It ("should deploy multiple infra providers with custom namespace and versions" , func () {
@@ -291,7 +292,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
291292 Expect (manifests ).ToNot (BeEmpty ())
292293 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "multiple-infra-custom-ns-versions.yaml" ))
293294 Expect (err ).ToNot (HaveOccurred ())
294- Expect (manifests ).To (Equal (string (expectedManifests )))
295+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
295296 })
296297
297298 It ("should deploy multiple control plane providers with custom namespace and versions" , func () {
@@ -307,7 +308,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
307308 Expect (manifests ).ToNot (BeEmpty ())
308309 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "multiple-control-plane-custom-ns-versions.yaml" ))
309310 Expect (err ).ToNot (HaveOccurred ())
310- Expect (manifests ).To (Equal (string (expectedManifests )))
311+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
311312 })
312313
313314 It ("should deploy multiple bootstrap providers with custom namespace and versions" , func () {
@@ -323,7 +324,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
323324 Expect (manifests ).ToNot (BeEmpty ())
324325 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "multiple-bootstrap-custom-ns-versions.yaml" ))
325326 Expect (err ).ToNot (HaveOccurred ())
326- Expect (manifests ).To (Equal (string (expectedManifests )))
327+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
327328 })
328329
329330 It ("should deploy core when only addon is specified" , func () {
@@ -336,7 +337,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
336337 Expect (manifests ).ToNot (BeEmpty ())
337338 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-addon.yaml" ))
338339 Expect (err ).ToNot (HaveOccurred ())
339- Expect (manifests ).To (Equal (string (expectedManifests )))
340+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
340341 })
341342
342343 It ("should deploy core, bootstrap, control plane when only infra and addon is specified" , func () {
@@ -350,7 +351,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
350351 Expect (manifests ).ToNot (BeEmpty ())
351352 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-infra-and-addon.yaml" ))
352353 Expect (err ).ToNot (HaveOccurred ())
353- Expect (manifests ).To (Equal (string (expectedManifests )))
354+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
354355 })
355356 It ("should deploy core and infra with feature gates enabled" , func () {
356357 manifests , err := helmChart .Run (map [string ]string {
@@ -372,7 +373,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
372373 Expect (manifests ).ToNot (BeEmpty ())
373374 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "feature-gates.yaml" ))
374375 Expect (err ).ToNot (HaveOccurred ())
375- Expect (manifests ).To (Equal (string (expectedManifests )))
376+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
376377 })
377378 It ("should deploy all providers with manager defined but no feature gates enabled" , func () {
378379 manifests , err := helmChart .Run (map [string ]string {
@@ -387,7 +388,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
387388 Expect (manifests ).ToNot (BeEmpty ())
388389 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-manager-defined-no-feature-gates.yaml" ))
389390 Expect (err ).ToNot (HaveOccurred ())
390- Expect (manifests ).To (Equal (string (expectedManifests )))
391+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
391392 })
392393 It ("should deploy all providers when manager is defined but another infrastructure spec field is defined" , func () {
393394 manifests , err := helmChart .Run (map [string ]string {
@@ -404,7 +405,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
404405 Expect (manifests ).ToNot (BeEmpty ())
405406 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "manager-defined-missing-other-infra-spec.yaml" ))
406407 Expect (err ).ToNot (HaveOccurred ())
407- Expect (manifests ).To (Equal (string (expectedManifests )))
408+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
408409 })
409410 It ("should deploy kubeadm control plane with manager specified" , func () {
410411 manifests , err := helmChart .Run (map [string ]string {
@@ -421,6 +422,6 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
421422 Expect (manifests ).ToNot (BeEmpty ())
422423 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "kubeadm-manager-defined.yaml" ))
423424 Expect (err ).ToNot (HaveOccurred ())
424- Expect (manifests ).To (Equal (string (expectedManifests )))
425+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
425426 })
426427})
0 commit comments