Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Jan 22, 2024
1 parent 06db091 commit ae0f681
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/ipam/ipamhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ae0f681

Please sign in to comment.