Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e: mustgather: add missing deployer initialization #1115

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions test/e2e/must-gather/must_gather_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems wrong

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed. I'll make it "collect available data" does that sound better?

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())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should never fail anyway so let's check err not occurred

Copy link
Member Author

@shajmakh shajmakh Dec 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can fail in case the cluster doesn't have the scheduler and we try to fetch it:
https://github.com/openshift-kni/numaresources-operator/blob/main/test/utils/deploy/deploy.go#L79

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the question is why the sudden change? why are we always running the deployment, even if E2E_NROP_INFRA_SETUP_SKIP exists.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my take is that we always want to have an instance of the current scheduler object. If the scheduler does already exist (skip setup), then we should just fetch the existing instance and move on; otherwise we need to setup it and then fetch the setupped instance. This is probably not too evident from the code and we likely need a bit larger refactoring.

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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't make sense to conditionally check the error. If we need to do GetDeploymentWithSched it must not fail.

ginkgo.By("skip setting up the cluster")
return
}
ginkgo.By("Setting up the cluster")
Expand Down
5 changes: 4 additions & 1 deletion test/utils/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems correct

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to set it first thing in case the cluster didn't have the scheduler and fails to get it

}

nroSchedKey := objects.NROSchedObjectKey()
nroSchedObj := nropv1.NUMAResourcesScheduler{}
err := e2eclient.Client.Get(ctx, nroSchedKey, &nroSchedObj)
Expand Down
Loading