Skip to content

Commit e903e19

Browse files
committed
fix lint
1 parent 75f1d99 commit e903e19

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

tests/e2e/e2e_suite_test.go

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func TestE2e(t *testing.T) {
4343
// The local clusterctl repository & the bootstrap cluster are created once and shared across all the tests.
4444
var _ = SynchronizedBeforeSuite(func() []byte {
4545
var err error
46+
ctx := context.Background()
4647

4748
configPath, err := os.Getwd()
4849
Expect(err).ToNot(HaveOccurred())
@@ -51,7 +52,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
5152
Expect(configPath).To(BeAnExistingFile(), "Invalid test suite argument. e2e.config should be an existing file.")
5253

5354
By("Loading the e2e test configuration from " + configPath)
54-
e2eConfig = clusterctl.LoadE2EConfig(context.TODO(), clusterctl.LoadE2EConfigInput{ConfigPath: configPath})
55+
e2eConfig = clusterctl.LoadE2EConfig(ctx, clusterctl.LoadE2EConfigInput{ConfigPath: configPath})
5556
Expect(e2eConfig).NotTo(BeNil(), "Failed to load E2E config from %s", configPath)
5657

5758
artifactFolder, err = filepath.Abs(".")
@@ -65,16 +66,16 @@ var _ = SynchronizedBeforeSuite(func() []byte {
6566
RepositoryFolder: repoPath,
6667
}
6768

68-
clusterctlConfigPath = clusterctl.CreateRepository(context.TODO(), createRepositoryInput)
69+
clusterctlConfigPath = clusterctl.CreateRepository(ctx, createRepositoryInput)
6970
Expect(clusterctlConfigPath).To(BeAnExistingFile(), "The clusterctl config file does not exists in the local repository: "+repoPath)
7071

7172
By("Setting up the bootstrap cluster")
72-
bootstrapClusterProvider, bootstrapClusterProxy = setupBootstrapCluster(e2eConfig, false)
73+
bootstrapClusterProvider, bootstrapClusterProxy = setupBootstrapCluster(ctx, e2eConfig, false)
7374

7475
clusterctlLogFolder = filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName())
7576

7677
By("Initializing the bootstrap cluster")
77-
initBootstrapCluster(bootstrapClusterProxy, e2eConfig, clusterctlConfigPath, artifactFolder)
78+
initBootstrapCluster(ctx, bootstrapClusterProxy, e2eConfig, clusterctlConfigPath, artifactFolder)
7879

7980
// encode the e2e config into the byte array.
8081
var configBuf bytes.Buffer
@@ -113,20 +114,23 @@ var _ = SynchronizedBeforeSuite(func() []byte {
113114
// Using a SynchronizedAfterSuite for controlling how to delete resources shared across ParallelNodes (~ginkgo threads).
114115
// The bootstrap cluster is shared across all the tests, so it should be deleted only after all ParallelNodes completes.
115116
// The local clusterctl repository is preserved like everything else created into the artifact folder.
116-
var _ = SynchronizedAfterSuite(func() {
117-
// After each ParallelNode.
118-
}, func() {
119-
// After all ParallelNodes.
117+
var _ = SynchronizedAfterSuite(afterEachParallelNode, afterAllParallelNodes)
120118

119+
// After each ParallelNode.
120+
func afterEachParallelNode() {}
121+
122+
// After all ParallelNodes.
123+
func afterAllParallelNodes() {
121124
By("Tearing down the management cluster")
122-
tearDown(bootstrapClusterProvider, bootstrapClusterProxy)
123-
})
125+
tearDown(context.Background(), bootstrapClusterProvider, bootstrapClusterProxy)
126+
}
124127

125-
func setupBootstrapCluster(config *clusterctl.E2EConfig, useExistingCluster bool) (bootstrap.ClusterProvider, framework.ClusterProxy) {
128+
func setupBootstrapCluster(ctx context.Context, config *clusterctl.E2EConfig, useExistingCluster bool) (bootstrap.ClusterProvider, framework.ClusterProxy) {
126129
var clusterProvider bootstrap.ClusterProvider
127-
kubeconfigPath := ""
130+
var kubeconfigPath string
131+
128132
if !useExistingCluster {
129-
clusterProvider = bootstrap.CreateKindBootstrapClusterAndLoadImages(context.TODO(), bootstrap.CreateKindBootstrapClusterAndLoadImagesInput{
133+
clusterProvider = bootstrap.CreateKindBootstrapClusterAndLoadImages(ctx, bootstrap.CreateKindBootstrapClusterAndLoadImagesInput{
130134
Name: config.ManagementClusterName,
131135
RequiresDockerSock: config.HasDockerProvider(),
132136
Images: config.Images,
@@ -143,7 +147,7 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, useExistingCluster bool
143147
Name: "capz-e2e",
144148
Images: config.Images,
145149
}
146-
err := bootstrap.LoadImagesToKindCluster(context.TODO(), imagesInput)
150+
err := bootstrap.LoadImagesToKindCluster(ctx, imagesInput)
147151
Expect(err).NotTo(HaveOccurred(), "Failed to load images to the bootstrap cluster: %s", err)
148152
}
149153

@@ -155,8 +159,8 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, useExistingCluster bool
155159
return clusterProvider, clusterProxy
156160
}
157161

158-
func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config *clusterctl.E2EConfig, clusterctlConfig, artifactFolder string) {
159-
clusterctl.InitManagementClusterAndWatchControllerLogs(context.TODO(), clusterctl.InitManagementClusterAndWatchControllerLogsInput{
162+
func initBootstrapCluster(ctx context.Context, bootstrapClusterProxy framework.ClusterProxy, config *clusterctl.E2EConfig, clusterctlConfig, artifactFolder string) {
163+
clusterctl.InitManagementClusterAndWatchControllerLogs(ctx, clusterctl.InitManagementClusterAndWatchControllerLogsInput{
160164
ClusterProxy: bootstrapClusterProxy,
161165
ClusterctlConfigPath: clusterctlConfig,
162166
InfrastructureProviders: config.InfrastructureProviders(),
@@ -165,12 +169,12 @@ func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config *
165169
}, config.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
166170
}
167171

168-
func tearDown(bootstrapClusterProvider bootstrap.ClusterProvider, bootstrapClusterProxy framework.ClusterProxy) {
172+
func tearDown(ctx context.Context, bootstrapClusterProvider bootstrap.ClusterProvider, bootstrapClusterProxy framework.ClusterProxy) {
169173
if bootstrapClusterProxy != nil {
170-
bootstrapClusterProxy.Dispose(context.TODO())
174+
bootstrapClusterProxy.Dispose(ctx)
171175
}
172176
if bootstrapClusterProvider != nil {
173-
bootstrapClusterProvider.Dispose(context.TODO())
177+
bootstrapClusterProvider.Dispose(ctx)
174178
}
175179
}
176180

0 commit comments

Comments
 (0)