Skip to content

Commit e026837

Browse files
lentzi90mdbooth
authored andcommitted
Remove It block from clusterctl upgrade
The ClusterctlUpgradeSpec contains a BeforeEach block so it cannot be nested in an It block. (cherry picked from commit b2bdc35)
1 parent 36a4a00 commit e026837

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

test/e2e/suites/e2e/clusterctl_upgrade_test.go

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package e2e
2121

2222
import (
2323
"context"
24+
"os"
2425

2526
. "github.com/onsi/ginkgo/v2"
2627
capi_e2e "sigs.k8s.io/cluster-api/test/e2e"
@@ -34,23 +35,26 @@ import (
3435
// When new minor releases are added (with the same contract) we will need to work on this
3536
// if we want to continue testing v0.6.
3637
var _ = Describe("When testing clusterctl upgrades (v0.6=>current) [clusterctl-upgrade]", func() {
37-
It("should succeed", func() {
38-
ctx := context.TODO()
39-
shared.SetEnvVar("USE_CI_ARTIFACTS", "true", false)
40-
shared.SetEnvVar("DOWNLOAD_E2E_IMAGE", "true", false)
41-
42-
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
43-
return capi_e2e.ClusterctlUpgradeSpecInput{
44-
E2EConfig: e2eCtx.E2EConfig,
45-
ClusterctlConfigPath: e2eCtx.Environment.ClusterctlConfigPath,
46-
BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy,
47-
ArtifactFolder: e2eCtx.Settings.ArtifactFolder,
48-
SkipCleanup: false,
49-
InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.3.0/clusterctl-{OS}-{ARCH}",
50-
InitWithProvidersContract: "v1beta1",
51-
MgmtFlavor: shared.FlavorDefault,
52-
WorkloadFlavor: shared.FlavorV1alpha5,
53-
}
54-
})
38+
ctx := context.TODO()
39+
// Set environment variables for rendering the cluster templates.
40+
// We cannot use shared.SetEnvVar here because it tries to log things
41+
// using `By`, which cannot be done outside of `It` blocks.
42+
// We cannot put this in an `It` block either since `ClusterctlUpgradeSpec`
43+
// contains `BeforeEach` which cannot be inside `It`.
44+
_ = os.Setenv("USE_CI_ARTIFACTS", "true")
45+
_ = os.Setenv("DOWNLOAD_E2E_IMAGE", "true")
46+
47+
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
48+
return capi_e2e.ClusterctlUpgradeSpecInput{
49+
E2EConfig: e2eCtx.E2EConfig,
50+
ClusterctlConfigPath: e2eCtx.Environment.ClusterctlConfigPath,
51+
BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy,
52+
ArtifactFolder: e2eCtx.Settings.ArtifactFolder,
53+
SkipCleanup: false,
54+
InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.3.0/clusterctl-{OS}-{ARCH}",
55+
InitWithProvidersContract: "v1beta1",
56+
MgmtFlavor: shared.FlavorDefault,
57+
WorkloadFlavor: shared.FlavorV1alpha5,
58+
}
5559
})
5660
})

0 commit comments

Comments
 (0)