From 1247fa386c05f8bdb39b436e480853f37da6178e Mon Sep 17 00:00:00 2001 From: Traian Schiau <55734665+trasc@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:37:49 +0300 Subject: [PATCH] [test][integration] Drop `fwk.RunManager` in favor of `SetupClient` and `StartManager` (#3179) --- test/integration/framework/framework.go | 6 ------ test/integration/kueuectl/suite_test.go | 3 ++- test/integration/scheduler/fairsharing/suite_test.go | 3 ++- test/integration/scheduler/suite_test.go | 3 ++- test/integration/webhook/core/suite_test.go | 3 ++- test/integration/webhook/jobs/pod_webhook_test.go | 2 +- test/integration/webhook/jobs/raycluster_webhook_test.go | 2 +- 7 files changed, 10 insertions(+), 12 deletions(-) diff --git a/test/integration/framework/framework.go b/test/integration/framework/framework.go index 7b98251c4b..e33cf88066 100644 --- a/test/integration/framework/framework.go +++ b/test/integration/framework/framework.go @@ -207,12 +207,6 @@ func (f *Framework) StopManager(ctx context.Context) { }) } -func (f *Framework) RunManager(cfg *rest.Config, managerSetup ManagerSetup) (context.Context, client.Client) { - ctx, k8sClient := f.SetupClient(cfg) - f.StartManager(ctx, cfg, managerSetup) - return ctx, k8sClient -} - func (f *Framework) Teardown() { ginkgo.By("tearing down the test environment") if f.cancel != nil { diff --git a/test/integration/kueuectl/suite_test.go b/test/integration/kueuectl/suite_test.go index e36ff1043e..36b02d831e 100644 --- a/test/integration/kueuectl/suite_test.go +++ b/test/integration/kueuectl/suite_test.go @@ -60,7 +60,8 @@ func TestKueuectl(t *testing.T) { var _ = ginkgo.BeforeSuite(func() { fwk = &framework.Framework{CRDPath: crdPath, WebhookPath: webhookPath} cfg = fwk.Init() - ctx, k8sClient = fwk.RunManager(cfg, managerSetup) + ctx, k8sClient = fwk.SetupClient(cfg) + fwk.StartManager(ctx, cfg, managerSetup) kassetsPath = os.Getenv("KUBEBUILDER_ASSETS") kueuectlPath = path.Join(os.Getenv("KUEUE_BIN"), "kubectl-kueue") diff --git a/test/integration/scheduler/fairsharing/suite_test.go b/test/integration/scheduler/fairsharing/suite_test.go index c10492e97d..555c7a7b1b 100644 --- a/test/integration/scheduler/fairsharing/suite_test.go +++ b/test/integration/scheduler/fairsharing/suite_test.go @@ -60,7 +60,8 @@ var _ = ginkgo.BeforeSuite(func() { WebhookPath: filepath.Join("..", "..", "..", "..", "config", "components", "webhook"), } cfg = fwk.Init() - ctx, k8sClient = fwk.RunManager(cfg, managerAndSchedulerSetup) + ctx, k8sClient = fwk.SetupClient(cfg) + fwk.StartManager(ctx, cfg, managerAndSchedulerSetup) }) var _ = ginkgo.AfterSuite(func() { diff --git a/test/integration/scheduler/suite_test.go b/test/integration/scheduler/suite_test.go index 803985c22a..086d2dc82f 100644 --- a/test/integration/scheduler/suite_test.go +++ b/test/integration/scheduler/suite_test.go @@ -60,7 +60,8 @@ var _ = ginkgo.BeforeSuite(func() { WebhookPath: filepath.Join("..", "..", "..", "config", "components", "webhook"), } cfg = fwk.Init() - ctx, k8sClient = fwk.RunManager(cfg, managerAndSchedulerSetup) + ctx, k8sClient = fwk.SetupClient(cfg) + fwk.StartManager(ctx, cfg, managerAndSchedulerSetup) }) var _ = ginkgo.AfterSuite(func() { diff --git a/test/integration/webhook/core/suite_test.go b/test/integration/webhook/core/suite_test.go index bb4424c0e7..752a14b747 100644 --- a/test/integration/webhook/core/suite_test.go +++ b/test/integration/webhook/core/suite_test.go @@ -56,7 +56,8 @@ var _ = ginkgo.BeforeSuite(func() { WebhookPath: filepath.Join("..", "..", "..", "..", "config", "components", "webhook"), } cfg = fwk.Init() - ctx, k8sClient = fwk.RunManager(cfg, func(ctx context.Context, mgr manager.Manager) { + ctx, k8sClient = fwk.SetupClient(cfg) + fwk.StartManager(ctx, cfg, func(ctx context.Context, mgr manager.Manager) { err := indexer.Setup(ctx, mgr.GetFieldIndexer()) gomega.Expect(err).NotTo(gomega.HaveOccurred()) diff --git a/test/integration/webhook/jobs/pod_webhook_test.go b/test/integration/webhook/jobs/pod_webhook_test.go index b1b46fef2e..b7e0c58204 100644 --- a/test/integration/webhook/jobs/pod_webhook_test.go +++ b/test/integration/webhook/jobs/pod_webhook_test.go @@ -179,7 +179,7 @@ var _ = ginkgo.Describe("Pod Webhook", func() { err = serverVersionFetcher.FetchServerVersion() gomega.Expect(err).NotTo(gomega.HaveOccurred()) - fwk.RunManager(cfg, managerSetup( + fwk.StartManager(ctx, cfg, managerSetup( pod.SetupWebhook, jobframework.WithManageJobsWithoutQueueName(true), jobframework.WithKubeServerVersion(serverVersionFetcher), diff --git a/test/integration/webhook/jobs/raycluster_webhook_test.go b/test/integration/webhook/jobs/raycluster_webhook_test.go index f64a0b48a9..e9f30eaabd 100644 --- a/test/integration/webhook/jobs/raycluster_webhook_test.go +++ b/test/integration/webhook/jobs/raycluster_webhook_test.go @@ -71,7 +71,7 @@ var _ = ginkgo.Describe("RayCluster Webhook", func() { ginkgo.When("With manageJobsWithoutQueueName enabled", ginkgo.Ordered, ginkgo.ContinueOnFailure, func() { ginkgo.BeforeAll(func() { - fwk.RunManager(cfg, managerSetup(func(mgr ctrl.Manager, opts ...jobframework.Option) error { + fwk.StartManager(ctx, cfg, managerSetup(func(mgr ctrl.Manager, opts ...jobframework.Option) error { reconciler := raycluster.NewReconciler( mgr.GetClient(), mgr.GetEventRecorderFor(constants.JobControllerName),