Skip to content

Commit

Permalink
chore: fix go vet error in tests
Browse files Browse the repository at this point in the history
This looks like it is now a blocker in 1.22.2 (?)
  • Loading branch information
justinsb committed May 8, 2024
1 parent ed44951 commit fb78327
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion config/tests/samples/create/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ package create

import (
"context"
"errors"
"fmt"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -237,19 +239,28 @@ func NewHarnessWithOptions(ctx context.Context, t *testing.T, opts *HarnessOptio
}
{
var wg sync.WaitGroup
var errsMutex sync.Mutex
var errs []error

for i := range crds {
crd := &crds[i]
wg.Add(1)
log.V(2).Info("loading crd", "name", crd.GetName())

go func() {
defer wg.Done()
if err := h.client.Create(ctx, crd.DeepCopy()); err != nil {
h.Fatalf("error creating crd %v: %v", crd.GroupVersionKind(), err)
errsMutex.Lock()
defer errsMutex.Unlock()
errs = append(errs, fmt.Errorf("error creating crd %v: %w", crd.GroupVersionKind(), err))
}
h.waitForCRDReady(crd)
}()
}
wg.Wait()
if len(errs) != 0 {
h.Fatalf("error creating crds: %v", errors.Join(errs...))
}
}
}

Expand Down

0 comments on commit fb78327

Please sign in to comment.