Skip to content

Commit c3218d8

Browse files
committed
Implement workaround for e2e tests
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
1 parent 7428e7b commit c3218d8

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

tests/e2e/downgrade_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var _ = Describe("Elemental Operator downgrade/upgrade test", func() {
5858
})
5959

6060
By("Install the new Elemental Operator", func() {
61-
deployOperator(k, &downgradeCfg)
61+
deployOperator(k, &downgradeCfg, true)
6262
})
6363

6464
By("Check it gets a default channel and syncs ManagedOSVersions", func() {
@@ -86,7 +86,7 @@ var _ = Describe("Elemental Operator downgrade/upgrade test", func() {
8686
})
8787

8888
By("Upgrading Elemental Operator to testing version", func() {
89-
deployOperator(k, e2eCfg)
89+
deployOperator(k, e2eCfg, false)
9090
})
9191

9292
By("Check we still keep the previous default channel managed by Helm", func() {

tests/e2e/e2e_suite_test.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ var _ = BeforeSuite(func() {
129129
err = k.WaitForNamespaceDelete(operatorNamespace)
130130
Expect(err).ToNot(HaveOccurred())
131131

132-
deployOperator(k, e2eCfg)
132+
deployOperator(k, e2eCfg, false)
133133

134134
// Somehow rancher needs to be restarted after an elemental-operator upgrade
135135
// to get machineregistration working
@@ -281,7 +281,7 @@ var _ = BeforeSuite(func() {
281281

282282
})
283283

284-
deployOperator(k, e2eCfg)
284+
deployOperator(k, e2eCfg, false)
285285
})
286286

287287
var _ = AfterSuite(func() {
@@ -299,11 +299,21 @@ func isOperatorInstalled(k *kubectl.Kubectl) bool {
299299
return len(pods) > 0
300300
}
301301

302-
func deployOperator(k *kubectl.Kubectl, config *e2eConfig.E2EConfig) {
302+
func deployOperator(k *kubectl.Kubectl, config *e2eConfig.E2EConfig, oldChartName bool) {
303+
// This is a temporary workaround to cope with the chart name change.
304+
// During the downgrade test we need to use the old name (with "-chart" suffix)
305+
// See: https://github.com/rancher/elemental-operator/issues/826
306+
chartName := operatorName
307+
chartCRDsName := operatorCRDsName
308+
if oldChartName {
309+
chartName = fmt.Sprintf("%s-chart", chartName)
310+
chartCRDsName = fmt.Sprintf("%s-chart", chartCRDsName)
311+
}
312+
303313
By("Deploying elemental-operator chart", func() {
304314
Expect(kubectl.RunHelmBinaryWithCustomErr(
305315
"upgrade", "--install",
306-
operatorCRDsName,
316+
chartCRDsName,
307317
config.CRDsChart,
308318
"--set", "debug=true",
309319
"--set", fmt.Sprintf("replicas=%s", config.OperatorReplicas),
@@ -329,7 +339,7 @@ func deployOperator(k *kubectl.Kubectl, config *e2eConfig.E2EConfig) {
329339

330340
Expect(kubectl.RunHelmBinaryWithCustomErr(
331341
"upgrade", "--install",
332-
operatorName,
342+
chartName,
333343
config.Chart,
334344
"--set", "debug=true",
335345
"--set", fmt.Sprintf("replicas=%s", config.OperatorReplicas),

0 commit comments

Comments
 (0)