diff --git a/test/e2e/cluster_upgrade_test.go b/test/e2e/cluster_upgrade_test.go index c0a6291eff86..ae53fed7634b 100644 --- a/test/e2e/cluster_upgrade_test.go +++ b/test/e2e/cluster_upgrade_test.go @@ -19,14 +19,12 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" ) var _ = Describe("When upgrading a workload cluster and testing K8S conformance [Conformance] [K8s-Upgrade]", func() { - ClusterUpgradeConformanceSpec(context.TODO(), func() ClusterUpgradeConformanceSpecInput { + ClusterUpgradeConformanceSpec(ctx, func() ClusterUpgradeConformanceSpecInput { return ClusterUpgradeConformanceSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, diff --git a/test/e2e/clusterctl_upgrade_test.go b/test/e2e/clusterctl_upgrade_test.go index 6ef92109a8a9..113a3ccff13c 100644 --- a/test/e2e/clusterctl_upgrade_test.go +++ b/test/e2e/clusterctl_upgrade_test.go @@ -19,14 +19,12 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" ) var _ = Describe("When testing clusterctl upgrades", func() { - ClusterctlUpgradeSpec(context.TODO(), func() ClusterctlUpgradeSpecInput { + ClusterctlUpgradeSpec(ctx, func() ClusterctlUpgradeSpecInput { return ClusterctlUpgradeSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 1df554f33405..df3de8294fbc 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -52,6 +52,8 @@ var ( // Test suite global vars var ( + ctx = context.Background() + // e2eConfig to be used for this test, read from configPath. e2eConfig *clusterctl.E2EConfig @@ -153,7 +155,7 @@ func initScheme() *runtime.Scheme { } func loadE2EConfig(configPath string) *clusterctl.E2EConfig { - config := clusterctl.LoadE2EConfig(context.TODO(), clusterctl.LoadE2EConfigInput{ConfigPath: configPath}) + config := clusterctl.LoadE2EConfig(ctx, clusterctl.LoadE2EConfigInput{ConfigPath: configPath}) Expect(config).ToNot(BeNil(), "Failed to load E2E config from %s", configPath) return config @@ -172,7 +174,7 @@ func createClusterctlLocalRepository(config *clusterctl.E2EConfig, repositoryFol createRepositoryInput.RegisterClusterResourceSetConfigMapTransformation(cniPath, CNIResources) - clusterctlConfig := clusterctl.CreateRepository(context.TODO(), createRepositoryInput) + clusterctlConfig := clusterctl.CreateRepository(ctx, createRepositoryInput) Expect(clusterctlConfig).To(BeAnExistingFile(), "The clusterctl config file does not exists in the local repository %s", repositoryFolder) return clusterctlConfig } @@ -181,7 +183,7 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, scheme *runtime.Scheme, var clusterProvider bootstrap.ClusterProvider kubeconfigPath := "" if !useExistingCluster { - clusterProvider = bootstrap.CreateKindBootstrapClusterAndLoadImages(context.TODO(), bootstrap.CreateKindBootstrapClusterAndLoadImagesInput{ + clusterProvider = bootstrap.CreateKindBootstrapClusterAndLoadImages(ctx, bootstrap.CreateKindBootstrapClusterAndLoadImagesInput{ Name: config.ManagementClusterName, RequiresDockerSock: config.HasDockerProvider(), Images: config.Images, @@ -200,7 +202,7 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, scheme *runtime.Scheme, } func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config *clusterctl.E2EConfig, clusterctlConfig, artifactFolder string) { - clusterctl.InitManagementClusterAndWatchControllerLogs(context.TODO(), clusterctl.InitManagementClusterAndWatchControllerLogsInput{ + clusterctl.InitManagementClusterAndWatchControllerLogs(ctx, clusterctl.InitManagementClusterAndWatchControllerLogsInput{ ClusterProxy: bootstrapClusterProxy, ClusterctlConfigPath: clusterctlConfig, InfrastructureProviders: config.InfrastructureProviders(), @@ -210,9 +212,9 @@ func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config * func tearDown(bootstrapClusterProvider bootstrap.ClusterProvider, bootstrapClusterProxy framework.ClusterProxy) { if bootstrapClusterProxy != nil { - bootstrapClusterProxy.Dispose(context.TODO()) + bootstrapClusterProxy.Dispose(ctx) } if bootstrapClusterProvider != nil { - bootstrapClusterProvider.Dispose(context.TODO()) + bootstrapClusterProvider.Dispose(ctx) } } diff --git a/test/e2e/k8s_conformance_test.go b/test/e2e/k8s_conformance_test.go index 64191b44d8fd..1697f24891aa 100644 --- a/test/e2e/k8s_conformance_test.go +++ b/test/e2e/k8s_conformance_test.go @@ -19,14 +19,12 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" ) var _ = Describe("When testing K8S conformance [Conformance]", func() { - K8SConformanceSpec(context.TODO(), func() K8SConformanceSpecInput { + K8SConformanceSpec(ctx, func() K8SConformanceSpecInput { return K8SConformanceSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, diff --git a/test/e2e/kcp_adoption.go b/test/e2e/kcp_adoption.go index f9c5de708566..21a537ccfc5f 100644 --- a/test/e2e/kcp_adoption.go +++ b/test/e2e/kcp_adoption.go @@ -123,7 +123,7 @@ func KCPAdoptionSpec(ctx context.Context, inputGetter func() KCPAdoptionSpecInpu Cluster: cluster, }, WaitForControlPlaneIntervals...) - workloadCluster := input.BootstrapClusterProxy.GetWorkloadCluster(context.TODO(), cluster.Namespace, cluster.Name) + workloadCluster := input.BootstrapClusterProxy.GetWorkloadCluster(ctx, cluster.Namespace, cluster.Name) framework.WaitForClusterMachinesReady(ctx, framework.WaitForClusterMachinesReadyInput{ GetLister: input.BootstrapClusterProxy.GetClient(), NodeGetter: workloadCluster.GetClient(), diff --git a/test/e2e/kcp_adoption_test.go b/test/e2e/kcp_adoption_test.go index 9b8396bba50c..b96327dba1bb 100644 --- a/test/e2e/kcp_adoption_test.go +++ b/test/e2e/kcp_adoption_test.go @@ -19,8 +19,6 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" "sigs.k8s.io/cluster-api/test/framework" @@ -28,7 +26,7 @@ import ( var _ = Describe("When testing KCP adoption", func() { - KCPAdoptionSpec(context.TODO(), func() KCPAdoptionSpecInput { + KCPAdoptionSpec(ctx, func() KCPAdoptionSpecInput { return KCPAdoptionSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, diff --git a/test/e2e/kcp_upgrade_test.go b/test/e2e/kcp_upgrade_test.go index 818e2323f54c..ec1378b37a84 100644 --- a/test/e2e/kcp_upgrade_test.go +++ b/test/e2e/kcp_upgrade_test.go @@ -19,15 +19,13 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" "sigs.k8s.io/cluster-api/test/framework/clusterctl" ) var _ = Describe("When testing KCP upgrade in a single control plane cluster", func() { - KCPUpgradeSpec(context.TODO(), func() KCPUpgradeSpecInput { + KCPUpgradeSpec(ctx, func() KCPUpgradeSpecInput { return KCPUpgradeSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, @@ -41,7 +39,7 @@ var _ = Describe("When testing KCP upgrade in a single control plane cluster", f }) var _ = Describe("When testing KCP upgrade in a HA cluster", func() { - KCPUpgradeSpec(context.TODO(), func() KCPUpgradeSpecInput { + KCPUpgradeSpec(ctx, func() KCPUpgradeSpecInput { return KCPUpgradeSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, @@ -55,7 +53,7 @@ var _ = Describe("When testing KCP upgrade in a HA cluster", func() { }) var _ = Describe("When testing KCP upgrade in a HA cluster using scale in rollout", func() { - KCPUpgradeSpec(context.TODO(), func() KCPUpgradeSpecInput { + KCPUpgradeSpec(ctx, func() KCPUpgradeSpecInput { return KCPUpgradeSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, diff --git a/test/e2e/machine_pool_test.go b/test/e2e/machine_pool_test.go index 326797bb3ee2..8765d8680c58 100644 --- a/test/e2e/machine_pool_test.go +++ b/test/e2e/machine_pool_test.go @@ -19,13 +19,11 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" ) var _ = Describe("When testing MachinePools", func() { - MachinePoolSpec(context.TODO(), func() MachinePoolInput { + MachinePoolSpec(ctx, func() MachinePoolInput { return MachinePoolInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, diff --git a/test/e2e/md_scale_test.go b/test/e2e/md_scale_test.go index f40fb7171fca..8f094ed496f7 100644 --- a/test/e2e/md_scale_test.go +++ b/test/e2e/md_scale_test.go @@ -19,14 +19,12 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" ) var _ = Describe("When testing MachineDeployment scale out/in", func() { - MachineDeploymentScaleSpec(context.TODO(), func() MachineDeploymentScaleSpecInput { + MachineDeploymentScaleSpec(ctx, func() MachineDeploymentScaleSpecInput { return MachineDeploymentScaleSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, diff --git a/test/e2e/md_upgrades_test.go b/test/e2e/md_upgrades_test.go index e709ad1068eb..46764478681a 100644 --- a/test/e2e/md_upgrades_test.go +++ b/test/e2e/md_upgrades_test.go @@ -19,14 +19,12 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" ) var _ = Describe("When testing MachineDeployment upgrades", func() { - MachineDeploymentUpgradesSpec(context.TODO(), func() MachineDeploymentUpgradesSpecInput { + MachineDeploymentUpgradesSpec(ctx, func() MachineDeploymentUpgradesSpecInput { return MachineDeploymentUpgradesSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, diff --git a/test/e2e/mhc_remediations_test.go b/test/e2e/mhc_remediations_test.go index 2c7d534210d5..2c4a440c2462 100644 --- a/test/e2e/mhc_remediations_test.go +++ b/test/e2e/mhc_remediations_test.go @@ -19,14 +19,12 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" ) var _ = Describe("When testing unhealthy machines remediation", func() { - MachineRemediationSpec(context.TODO(), func() MachineRemediationSpecInput { + MachineRemediationSpec(ctx, func() MachineRemediationSpecInput { return MachineRemediationSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, diff --git a/test/e2e/node_drain_timeout.go b/test/e2e/node_drain_timeout.go index d8b521a1add8..5cad56ecf963 100644 --- a/test/e2e/node_drain_timeout.go +++ b/test/e2e/node_drain_timeout.go @@ -99,7 +99,7 @@ func NodeDrainTimeoutSpec(ctx context.Context, inputGetter func() NodeDrainTimeo Expect(machineDeployments[0].Spec.Replicas).To(Equal(pointer.Int32Ptr(1))) By("Add a deployment with unevictable pods and podDisruptionBudget to the workload cluster. The deployed pods cannot be evicted in the node draining process.") - workloadClusterProxy := input.BootstrapClusterProxy.GetWorkloadCluster(context.TODO(), cluster.Namespace, cluster.Name) + workloadClusterProxy := input.BootstrapClusterProxy.GetWorkloadCluster(ctx, cluster.Namespace, cluster.Name) framework.DeployUnevictablePod(ctx, framework.DeployUnevictablePodInput{ WorkloadClusterProxy: workloadClusterProxy, DeploymentName: fmt.Sprintf("%s-%s", "unevictable-pod", util.RandomString(3)), diff --git a/test/e2e/node_drain_timeout_test.go b/test/e2e/node_drain_timeout_test.go index 7634c97e5ba1..ae24b9459cae 100644 --- a/test/e2e/node_drain_timeout_test.go +++ b/test/e2e/node_drain_timeout_test.go @@ -19,14 +19,12 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" ) var _ = Describe("When testing node drain timeout", func() { - NodeDrainTimeoutSpec(context.TODO(), func() NodeDrainTimeoutSpecInput { + NodeDrainTimeoutSpec(ctx, func() NodeDrainTimeoutSpecInput { return NodeDrainTimeoutSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, diff --git a/test/e2e/quick_start_test.go b/test/e2e/quick_start_test.go index 3dcdc4ff904e..ddb85c82f5d1 100644 --- a/test/e2e/quick_start_test.go +++ b/test/e2e/quick_start_test.go @@ -19,14 +19,12 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" ) var _ = Describe("When following the Cluster API quick-start [PR-Blocking]", func() { - QuickStartSpec(context.TODO(), func() QuickStartSpecInput { + QuickStartSpec(ctx, func() QuickStartSpecInput { return QuickStartSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, diff --git a/test/e2e/self_hosted_test.go b/test/e2e/self_hosted_test.go index a964e7b8bc9a..4d6092f28f0f 100644 --- a/test/e2e/self_hosted_test.go +++ b/test/e2e/self_hosted_test.go @@ -19,14 +19,12 @@ limitations under the License. package e2e import ( - "context" - . "github.com/onsi/ginkgo" ) var _ = Describe("When testing Cluster API working on self-hosted clusters", func() { - SelfHostedSpec(context.TODO(), func() SelfHostedSpecInput { + SelfHostedSpec(ctx, func() SelfHostedSpecInput { return SelfHostedSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath,