Skip to content

Commit 7132e62

Browse files
Add test for tracking helm chart installation differences
1 parent 45a6c0e commit 7132e62

File tree

4 files changed

+6837
-19
lines changed

4 files changed

+6837
-19
lines changed

test/e2e/e2e_suite_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ func initHelmChart() {
346346
Name: "capi-operator",
347347
Kubeconfig: helmClusterProxy.GetKubeconfigPath(),
348348
DryRun: true,
349+
Output: operatorframework.Hooks,
349350
}
350351
}
351352

test/e2e/helm_test.go

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,31 @@ limitations under the License.
2020
package e2e
2121

2222
import (
23-
"os"
24-
2523
. "github.com/onsi/ginkgo/v2"
2624
. "github.com/onsi/gomega"
25+
"os"
26+
"path/filepath"
27+
. "sigs.k8s.io/cluster-api-operator/test/framework"
2728
)
2829

2930
var _ = Describe("Create a proper set of manifests when using helm charts", func() {
31+
It("should deploy default manifest set for quick-start process", func() {
32+
fullInstallChart := &HelmChart{
33+
BinaryPath: helmChart.BinaryPath,
34+
Path: helmChart.Path,
35+
Name: helmChart.Name,
36+
Kubeconfig: helmChart.Kubeconfig,
37+
DryRun: helmChart.DryRun,
38+
Output: Manifests,
39+
AdditionalFlags: []string{"-n=capi-operator-system", "--create-namespace"},
40+
}
41+
fullInstallChart.Output = Manifests
42+
manifests, err := fullInstallChart.InstallChart(nil)
43+
Expect(err).ToNot(HaveOccurred())
44+
fullChartInstall, err := os.ReadFile(filepath.Join(customManifestsFolder, "full-chart-install.yaml"))
45+
Expect(manifests).To(Equal(string(fullChartInstall)))
46+
})
47+
3048
It("should not deploy providers when none specified", func() {
3149
manifests, err := helmChart.InstallChart(nil)
3250
Expect(err).ToNot(HaveOccurred())
@@ -44,7 +62,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
4462
})
4563
Expect(err).ToNot(HaveOccurred())
4664
Expect(manifests).ToNot(BeEmpty())
47-
expectedManifests, err := os.ReadFile(customManifestsFolder + "all-providers-custom-ns-versions.yaml")
65+
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "all-providers-custom-ns-versions.yaml"))
4866
Expect(err).ToNot(HaveOccurred())
4967
Expect(manifests).To(Equal(string(expectedManifests)))
5068
})
@@ -60,7 +78,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
6078
})
6179
Expect(err).ToNot(HaveOccurred())
6280
Expect(manifests).ToNot(BeEmpty())
63-
expectedManifests, err := os.ReadFile(customManifestsFolder + "all-providers-custom-versions.yaml")
81+
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "all-providers-custom-versions.yaml"))
6482
Expect(err).ToNot(HaveOccurred())
6583
Expect(manifests).To(Equal(string(expectedManifests)))
6684
})
@@ -76,7 +94,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
7694
})
7795
Expect(err).ToNot(HaveOccurred())
7896
Expect(manifests).ToNot(BeEmpty())
79-
expectedManifests, err := os.ReadFile(customManifestsFolder + "all-providers-latest-versions.yaml")
97+
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "all-providers-latest-versions.yaml"))
8098
Expect(err).ToNot(HaveOccurred())
8199
Expect(manifests).To(Equal(string(expectedManifests)))
82100
})
@@ -89,7 +107,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
89107
})
90108
Expect(err).ToNot(HaveOccurred())
91109
Expect(manifests).ToNot(BeEmpty())
92-
expectedManifests, err := os.ReadFile(customManifestsFolder + "only-infra.yaml")
110+
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "only-infra.yaml"))
93111
Expect(err).ToNot(HaveOccurred())
94112
Expect(manifests).To(Equal(string(expectedManifests)))
95113
})
@@ -102,7 +120,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
102120
})
103121
Expect(err).ToNot(HaveOccurred())
104122
Expect(manifests).ToNot(BeEmpty())
105-
expectedManifests, err := os.ReadFile(customManifestsFolder + "only-bootstrap.yaml")
123+
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "only-bootstrap.yaml"))
106124
Expect(err).ToNot(HaveOccurred())
107125
Expect(manifests).To(Equal(string(expectedManifests)))
108126
})
@@ -115,7 +133,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
115133
})
116134
Expect(err).ToNot(HaveOccurred())
117135
Expect(manifests).ToNot(BeEmpty())
118-
expectedManifests, err := os.ReadFile(customManifestsFolder + "only-control-plane.yaml")
136+
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "only-control-plane.yaml"))
119137
Expect(err).ToNot(HaveOccurred())
120138
Expect(manifests).To(Equal(string(expectedManifests)))
121139
})
@@ -128,7 +146,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
128146
})
129147
Expect(err).ToNot(HaveOccurred())
130148
Expect(manifests).ToNot(BeEmpty())
131-
expectedManifests, err := os.ReadFile(customManifestsFolder + "multiple-infra-custom-ns-versions.yaml")
149+
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "multiple-infra-custom-ns-versions.yaml"))
132150
Expect(err).ToNot(HaveOccurred())
133151
Expect(manifests).To(Equal(string(expectedManifests)))
134152
})
@@ -141,7 +159,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
141159
})
142160
Expect(err).ToNot(HaveOccurred())
143161
Expect(manifests).ToNot(BeEmpty())
144-
expectedManifests, err := os.ReadFile(customManifestsFolder + "multiple-control-plane-custom-ns-versions.yaml")
162+
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "multiple-control-plane-custom-ns-versions.yaml"))
145163
Expect(err).ToNot(HaveOccurred())
146164
Expect(manifests).To(Equal(string(expectedManifests)))
147165
})
@@ -154,7 +172,7 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
154172
})
155173
Expect(err).ToNot(HaveOccurred())
156174
Expect(manifests).ToNot(BeEmpty())
157-
expectedManifests, err := os.ReadFile(customManifestsFolder + "multiple-bootstrap-custom-ns-versions.yaml")
175+
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "multiple-bootstrap-custom-ns-versions.yaml"))
158176
Expect(err).ToNot(HaveOccurred())
159177
Expect(manifests).To(Equal(string(expectedManifests)))
160178
})

0 commit comments

Comments
 (0)