@@ -41,6 +41,11 @@ import (
41
41
ctrl "sigs.k8s.io/controller-runtime"
42
42
)
43
43
44
+ var (
45
+ // watchesCtx is used in log streaming to be able to get canceled via cancelWatches after ending the test suite.
46
+ watchesCtx , cancelWatches = context .WithCancel (context .Background ())
47
+ )
48
+
44
49
func init () {
45
50
flag .StringVar (& configPath , "e2e.config" , "" , "path to the e2e config file" )
46
51
flag .StringVar (& artifactFolder , "e2e.artifacts-folder" , "" , "folder where e2e test artifact should be stored" )
@@ -136,7 +141,7 @@ func loadE2EConfig(configPath string) *clusterctl.E2EConfig {
136
141
config := clusterctl .LoadE2EConfig (context .TODO (), clusterctl.LoadE2EConfigInput {ConfigPath : configPath })
137
142
Expect (config ).NotTo (BeNil (), "Failed to load E2E config from %s" , configPath )
138
143
139
- resolveKubernetesVersions (config )
144
+ resolveKubernetesVersions (ctx , config )
140
145
141
146
return config
142
147
}
@@ -188,7 +193,7 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, useExistingCluster bool
188
193
}
189
194
190
195
func initBootstrapCluster (bootstrapClusterProxy framework.ClusterProxy , config * clusterctl.E2EConfig , clusterctlConfig , artifactFolder string ) {
191
- clusterctl .InitManagementClusterAndWatchControllerLogs (context . TODO () , clusterctl.InitManagementClusterAndWatchControllerLogsInput {
196
+ clusterctl .InitManagementClusterAndWatchControllerLogs (watchesCtx , clusterctl.InitManagementClusterAndWatchControllerLogsInput {
192
197
ClusterProxy : bootstrapClusterProxy ,
193
198
ClusterctlConfigPath : clusterctlConfig ,
194
199
InfrastructureProviders : config .InfrastructureProviders (),
@@ -198,6 +203,7 @@ func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config *
198
203
}
199
204
200
205
func tearDown (bootstrapClusterProvider bootstrap.ClusterProvider , bootstrapClusterProxy framework.ClusterProxy ) {
206
+ cancelWatches ()
201
207
if bootstrapClusterProxy != nil {
202
208
bootstrapClusterProxy .Dispose (context .TODO ())
203
209
}
0 commit comments