@@ -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"
@@ -138,7 +139,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
138139 Expect (err ).ToNot (HaveOccurred ())
139140 fullChartInstall , err := os .ReadFile (filepath .Join (customManifestsFolder , "full-chart-install.yaml" ))
140141 Expect (err ).ToNot (HaveOccurred ())
141- Expect (manifests ).To (Equal (string (fullChartInstall )))
142+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (fullChartInstall ) )))
142143 })
143144
144145 It ("should not deploy providers when none specified" , func () {
@@ -168,7 +169,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
168169 Expect (manifests ).ToNot (BeEmpty ())
169170 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-custom-ns-versions.yaml" ))
170171 Expect (err ).ToNot (HaveOccurred ())
171- Expect (manifests ).To (Equal (string (expectedManifests )))
172+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
172173 })
173174
174175 It ("should deploy all providers with custom versions" , func () {
@@ -186,7 +187,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
186187 Expect (manifests ).ToNot (BeEmpty ())
187188 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-custom-versions.yaml" ))
188189 Expect (err ).ToNot (HaveOccurred ())
189- Expect (manifests ).To (Equal (string (expectedManifests )))
190+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
190191 })
191192
192193 It ("should deploy all providers with latest version" , func () {
@@ -204,7 +205,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
204205 Expect (manifests ).ToNot (BeEmpty ())
205206 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-latest-versions.yaml" ))
206207 Expect (err ).ToNot (HaveOccurred ())
207- Expect (manifests ).To (Equal (string (expectedManifests )))
208+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
208209 })
209210
210211 It ("should deploy core, bootstrap, control plane when only infra is specified" , func () {
@@ -217,7 +218,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
217218 Expect (manifests ).ToNot (BeEmpty ())
218219 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-infra.yaml" ))
219220 Expect (err ).ToNot (HaveOccurred ())
220- Expect (manifests ).To (Equal (string (expectedManifests )))
221+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
221222 })
222223
223224 It ("should deploy core when only bootstrap is specified" , func () {
@@ -230,7 +231,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
230231 Expect (manifests ).ToNot (BeEmpty ())
231232 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-bootstrap.yaml" ))
232233 Expect (err ).ToNot (HaveOccurred ())
233- Expect (manifests ).To (Equal (string (expectedManifests )))
234+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
234235 })
235236
236237 It ("should deploy core when only control plane is specified" , func () {
@@ -243,7 +244,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
243244 Expect (manifests ).ToNot (BeEmpty ())
244245 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-control-plane.yaml" ))
245246 Expect (err ).ToNot (HaveOccurred ())
246- Expect (manifests ).To (Equal (string (expectedManifests )))
247+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
247248 })
248249
249250 It ("should deploy core when only ipam is specified" , func () {
@@ -256,7 +257,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
256257 Expect (manifests ).ToNot (BeEmpty ())
257258 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-ipam.yaml" ))
258259 Expect (err ).ToNot (HaveOccurred ())
259- Expect (manifests ).To (Equal (string (expectedManifests )))
260+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
260261 })
261262
262263 It ("should deploy core, bootstrap, control plane when only infra and ipam is specified" , func () {
@@ -270,7 +271,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
270271 Expect (manifests ).ToNot (BeEmpty ())
271272 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-infra-and-ipam.yaml" ))
272273 Expect (err ).ToNot (HaveOccurred ())
273- Expect (manifests ).To (Equal (string (expectedManifests )))
274+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
274275 })
275276
276277 It ("should deploy multiple infra providers with custom namespace and versions" , func () {
@@ -286,7 +287,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
286287 Expect (manifests ).ToNot (BeEmpty ())
287288 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "multiple-infra-custom-ns-versions.yaml" ))
288289 Expect (err ).ToNot (HaveOccurred ())
289- Expect (manifests ).To (Equal (string (expectedManifests )))
290+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
290291 })
291292
292293 It ("should deploy multiple control plane providers with custom namespace and versions" , func () {
@@ -302,7 +303,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
302303 Expect (manifests ).ToNot (BeEmpty ())
303304 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "multiple-control-plane-custom-ns-versions.yaml" ))
304305 Expect (err ).ToNot (HaveOccurred ())
305- Expect (manifests ).To (Equal (string (expectedManifests )))
306+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
306307 })
307308
308309 It ("should deploy multiple bootstrap providers with custom namespace and versions" , func () {
@@ -318,7 +319,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
318319 Expect (manifests ).ToNot (BeEmpty ())
319320 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "multiple-bootstrap-custom-ns-versions.yaml" ))
320321 Expect (err ).ToNot (HaveOccurred ())
321- Expect (manifests ).To (Equal (string (expectedManifests )))
322+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
322323 })
323324
324325 It ("should deploy core when only addon is specified" , func () {
@@ -331,7 +332,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
331332 Expect (manifests ).ToNot (BeEmpty ())
332333 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-addon.yaml" ))
333334 Expect (err ).ToNot (HaveOccurred ())
334- Expect (manifests ).To (Equal (string (expectedManifests )))
335+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
335336 })
336337
337338 It ("should deploy core, bootstrap, control plane when only infra and addon is specified" , func () {
@@ -345,7 +346,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
345346 Expect (manifests ).ToNot (BeEmpty ())
346347 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "only-infra-and-addon.yaml" ))
347348 Expect (err ).ToNot (HaveOccurred ())
348- Expect (manifests ).To (Equal (string (expectedManifests )))
349+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
349350 })
350351 It ("should deploy core and infra with feature gates enabled" , func () {
351352 manifests , err := helmChart .Run (map [string ]string {
@@ -367,7 +368,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
367368 Expect (manifests ).ToNot (BeEmpty ())
368369 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "feature-gates.yaml" ))
369370 Expect (err ).ToNot (HaveOccurred ())
370- Expect (manifests ).To (Equal (string (expectedManifests )))
371+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
371372 })
372373 It ("should deploy all providers with manager defined but no feature gates enabled" , func () {
373374 manifests , err := helmChart .Run (map [string ]string {
@@ -382,7 +383,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
382383 Expect (manifests ).ToNot (BeEmpty ())
383384 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "all-providers-manager-defined-no-feature-gates.yaml" ))
384385 Expect (err ).ToNot (HaveOccurred ())
385- Expect (manifests ).To (Equal (string (expectedManifests )))
386+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
386387 })
387388 It ("should deploy all providers when manager is defined but another infrastructure spec field is defined" , func () {
388389 manifests , err := helmChart .Run (map [string ]string {
@@ -399,7 +400,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
399400 Expect (manifests ).ToNot (BeEmpty ())
400401 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "manager-defined-missing-other-infra-spec.yaml" ))
401402 Expect (err ).ToNot (HaveOccurred ())
402- Expect (manifests ).To (Equal (string (expectedManifests )))
403+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
403404 })
404405 It ("should deploy kubeadm control plane with manager specified" , func () {
405406 manifests , err := helmChart .Run (map [string ]string {
@@ -416,6 +417,6 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
416417 Expect (manifests ).ToNot (BeEmpty ())
417418 expectedManifests , err := os .ReadFile (filepath .Join (customManifestsFolder , "kubeadm-manager-defined.yaml" ))
418419 Expect (err ).ToNot (HaveOccurred ())
419- Expect (manifests ).To (Equal (string (expectedManifests )))
420+ Expect (manifests ).To (Equal (strings . TrimSpace ( string (expectedManifests ) )))
420421 })
421422})
0 commit comments