Skip to content

Commit 09acbec

Browse files
committed
pass cancellable context to log streamer
1 parent b17b877 commit 09acbec

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/e2e/e2e_suite_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ import (
4141
ctrl "sigs.k8s.io/controller-runtime"
4242
)
4343

44+
var (
45+
// watchesCtx is used in log streaming to be able to get canceld via cancelWatches after ending the test suite.
46+
watchesCtx, cancelWatches = context.WithCancel(context.Background())
47+
)
48+
4449
func init() {
4550
flag.StringVar(&configPath, "e2e.config", "", "path to the e2e config file")
4651
flag.StringVar(&artifactFolder, "e2e.artifacts-folder", "", "folder where e2e test artifact should be stored")
@@ -188,7 +193,7 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, useExistingCluster bool
188193
}
189194

190195
func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config *clusterctl.E2EConfig, clusterctlConfig, artifactFolder string) {
191-
clusterctl.InitManagementClusterAndWatchControllerLogs(context.TODO(), clusterctl.InitManagementClusterAndWatchControllerLogsInput{
196+
clusterctl.InitManagementClusterAndWatchControllerLogs(watchesCtx, clusterctl.InitManagementClusterAndWatchControllerLogsInput{
192197
ClusterProxy: bootstrapClusterProxy,
193198
ClusterctlConfigPath: clusterctlConfig,
194199
InfrastructureProviders: config.InfrastructureProviders(),
@@ -198,6 +203,7 @@ func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config *
198203
}
199204

200205
func tearDown(bootstrapClusterProvider bootstrap.ClusterProvider, bootstrapClusterProxy framework.ClusterProxy) {
206+
cancelWatches()
201207
if bootstrapClusterProxy != nil {
202208
bootstrapClusterProxy.Dispose(context.TODO())
203209
}

0 commit comments

Comments
 (0)