@@ -19,7 +19,6 @@ limitations under the License.
1919package e2e
2020
2121import (
22- "context"
2322 "flag"
2423 "os"
2524 "path/filepath"
@@ -28,6 +27,7 @@ import (
2827
2928 . "github.com/onsi/ginkgo"
3029 . "github.com/onsi/gomega"
30+ ctrl "sigs.k8s.io/controller-runtime"
3131
3232 "k8s.io/apimachinery/pkg/runtime"
3333 "sigs.k8s.io/cluster-api/test/framework"
5252
5353// Test suite global vars
5454var (
55+ ctx = ctrl .SetupSignalHandler ()
56+
5557 // e2eConfig to be used for this test, read from configPath.
5658 e2eConfig * clusterctl.E2EConfig
5759
@@ -153,7 +155,7 @@ func initScheme() *runtime.Scheme {
153155}
154156
155157func loadE2EConfig (configPath string ) * clusterctl.E2EConfig {
156- config := clusterctl .LoadE2EConfig (context . TODO () , clusterctl.LoadE2EConfigInput {ConfigPath : configPath })
158+ config := clusterctl .LoadE2EConfig (ctx , clusterctl.LoadE2EConfigInput {ConfigPath : configPath })
157159 Expect (config ).ToNot (BeNil (), "Failed to load E2E config from %s" , configPath )
158160
159161 return config
@@ -172,7 +174,7 @@ func createClusterctlLocalRepository(config *clusterctl.E2EConfig, repositoryFol
172174
173175 createRepositoryInput .RegisterClusterResourceSetConfigMapTransformation (cniPath , CNIResources )
174176
175- clusterctlConfig := clusterctl .CreateRepository (context . TODO () , createRepositoryInput )
177+ clusterctlConfig := clusterctl .CreateRepository (ctx , createRepositoryInput )
176178 Expect (clusterctlConfig ).To (BeAnExistingFile (), "The clusterctl config file does not exists in the local repository %s" , repositoryFolder )
177179 return clusterctlConfig
178180}
@@ -181,7 +183,7 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, scheme *runtime.Scheme,
181183 var clusterProvider bootstrap.ClusterProvider
182184 kubeconfigPath := ""
183185 if ! useExistingCluster {
184- clusterProvider = bootstrap .CreateKindBootstrapClusterAndLoadImages (context . TODO () , bootstrap.CreateKindBootstrapClusterAndLoadImagesInput {
186+ clusterProvider = bootstrap .CreateKindBootstrapClusterAndLoadImages (ctx , bootstrap.CreateKindBootstrapClusterAndLoadImagesInput {
185187 Name : config .ManagementClusterName ,
186188 RequiresDockerSock : config .HasDockerProvider (),
187189 Images : config .Images ,
@@ -200,7 +202,7 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, scheme *runtime.Scheme,
200202}
201203
202204func initBootstrapCluster (bootstrapClusterProxy framework.ClusterProxy , config * clusterctl.E2EConfig , clusterctlConfig , artifactFolder string ) {
203- clusterctl .InitManagementClusterAndWatchControllerLogs (context . TODO () , clusterctl.InitManagementClusterAndWatchControllerLogsInput {
205+ clusterctl .InitManagementClusterAndWatchControllerLogs (ctx , clusterctl.InitManagementClusterAndWatchControllerLogsInput {
204206 ClusterProxy : bootstrapClusterProxy ,
205207 ClusterctlConfigPath : clusterctlConfig ,
206208 InfrastructureProviders : config .InfrastructureProviders (),
@@ -210,9 +212,9 @@ func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config *
210212
211213func tearDown (bootstrapClusterProvider bootstrap.ClusterProvider , bootstrapClusterProxy framework.ClusterProxy ) {
212214 if bootstrapClusterProxy != nil {
213- bootstrapClusterProxy .Dispose (context . TODO () )
215+ bootstrapClusterProxy .Dispose (ctx )
214216 }
215217 if bootstrapClusterProvider != nil {
216- bootstrapClusterProvider .Dispose (context . TODO () )
218+ bootstrapClusterProvider .Dispose (ctx )
217219 }
218220}
0 commit comments