From 9cd43f1d637fe3f2fa0930b16d022b909beeaf34 Mon Sep 17 00:00:00 2001 From: Shereen Haj Date: Fri, 13 Dec 2024 12:33:45 +0200 Subject: [PATCH] e2e: mustgather: add missing deployer initialization Without the deployer initialization, deployment.deployer is nil and causes the test to panic. Fix that by calling deploy.NewForPlatform(). Signed-off-by: Shereen Haj --- test/e2e/must-gather/must_gather_suite_test.go | 11 ++++++----- test/utils/deploy/deploy.go | 5 ++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/test/e2e/must-gather/must_gather_suite_test.go b/test/e2e/must-gather/must_gather_suite_test.go index 838cdc423..84596c2f1 100644 --- a/test/e2e/must-gather/must_gather_suite_test.go +++ b/test/e2e/must-gather/must_gather_suite_test.go @@ -62,12 +62,13 @@ var _ = ginkgo.BeforeSuite(func() { mustGatherTag = getStringValueFromEnv(envVarMustGatherTag, defaultMustGatherTag) ginkgo.By(fmt.Sprintf("Using must-gather image %q tag %q", mustGatherImage, mustGatherTag)) + ginkgo.By("Fetching up cluster data") + var err error + // the error might be not nil we'll decide if that's fine or not depending on E2E_NROP_INFRA_SETUP_SKIP + deployment, err = deploy.GetDeploymentWithSched(context.TODO()) if _, ok := os.LookupEnv("E2E_NROP_INFRA_SETUP_SKIP"); ok { - ginkgo.By("Fetching up cluster data") - - var err error - deployment, err = deploy.GetDeploymentWithSched(context.TODO()) - gomega.Expect(err).ToNot(gomega.HaveOccurred()) + gomega.Expect(err).ToNot(gomega.HaveOccurred(), "infra setup skip but Scheduler instance not found") + ginkgo.By("skip setting up the cluster") return } ginkgo.By("Setting up the cluster") diff --git a/test/utils/deploy/deploy.go b/test/utils/deploy/deploy.go index c3ee17bf5..7ae0bcf37 100644 --- a/test/utils/deploy/deploy.go +++ b/test/utils/deploy/deploy.go @@ -71,7 +71,10 @@ func NewForPlatform(plat platform.Platform) Deployer { } func GetDeploymentWithSched(ctx context.Context) (NroDeploymentWithSched, error) { - sd := NroDeploymentWithSched{} + sd := NroDeploymentWithSched{ + Deployer: NewForPlatform(configuration.Plat), + } + nroSchedKey := objects.NROSchedObjectKey() nroSchedObj := nropv1.NUMAResourcesScheduler{} err := e2eclient.Client.Get(ctx, nroSchedKey, &nroSchedObj)