From ae0f6816b7330cf1e91b2ca3d4a356b5ea890ede Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Mon, 22 Jan 2024 14:16:24 +0100 Subject: [PATCH] fixes --- test/e2e/e2e_suite_test.go | 6 ++---- test/e2e/ipam/ipamhelper.go | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 47c94f122a..260f1c304c 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -197,10 +197,8 @@ var _ = SynchronizedBeforeSuite(func() []byte { ipamLabels[splittedLabel[0]] = splittedLabel[1] } - if e2eIPAMKubeconfig != "" { - ipamHelper, err = ipam.New(e2eIPAMKubeconfig, ipamLabels, skipCleanup) - Expect(err).ToNot(HaveOccurred()) - } + ipamHelper, err = ipam.New(e2eIPAMKubeconfig, ipamLabels, skipCleanup) + Expect(err).ToNot(HaveOccurred()) }) // Using a SynchronizedAfterSuite for controlling how to delete resources shared across ParallelNodes (~ginkgo threads). diff --git a/test/e2e/ipam/ipamhelper.go b/test/e2e/ipam/ipamhelper.go index cc35d0ed60..f877d4ecbb 100644 --- a/test/e2e/ipam/ipamhelper.go +++ b/test/e2e/ipam/ipamhelper.go @@ -73,13 +73,13 @@ type Helper interface { } // New returns an ipam.Helper. If e2eIPAMKubeconfig is an empty string or skipCleanup is true -// it will return a noop helper which does nothing so we cann fallback on setting environment variables. +// it will return a noop helper which does nothing so we can fallback on setting environment variables. func New(e2eIPAMKubeconfig string, labels map[string]string, skipCleanup bool) (Helper, error) { if len(labels) == 0 { return nil, fmt.Errorf("expecting labels to be set to prevent deletion of other IPAddressClaims") } - if e2eIPAMKubeconfig == "" || skipCleanup { + if e2eIPAMKubeconfig == "" { return &noopHelper{}, nil } @@ -213,7 +213,7 @@ func (h *helper) Teardown(ctx context.Context, folderName string, vSphereClient errList = append(errList, err) } - if len(errList) > 1 { + if len(errList) > 0 { return kerrors.NewAggregate(errList) } return nil @@ -324,7 +324,7 @@ func (h *helper) claimIPAddress(ctx context.Context) (_ string, _ *ipamv1.IPAddr return true, nil }) if retryError != nil { - return "", claim, retryError + return "", nil, retryError } return ip.Spec.Address, claim, nil