Skip to content

Commit

Permalink
Fix ineffassign
Browse files Browse the repository at this point in the history
Signed-off-by: jtucci <jonytucci01@gmail.com>
  • Loading branch information
jtucci committed Oct 9, 2023
1 parent b30103d commit 45c9e39
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/test/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,25 +278,27 @@ func (s *Step) CheckResource(expected runtime.Object, namespace string) []error
actual := unstructured.Unstructured{}
actual.SetGroupVersionKind(gvk)

err = cl.Get(context.TODO(), client.ObjectKey{
if err := cl.Get(context.TODO(), client.ObjectKey{
Namespace: namespace,
Name: name,
}, &actual)
}, &actual); err != nil {
return append(testErrors, err)
}

actuals = append(actuals, actual)
} else {
m, err := meta.Accessor(expected)
if err != nil {
return append(testErrors, err)
}
actuals, err = list(cl, gvk, namespace, m.GetLabels())
actuals, err := list(cl, gvk, namespace, m.GetLabels())
if err != nil {
return append(testErrors, err)
}
if len(actuals) == 0 {
testErrors = append(testErrors, fmt.Errorf("no resources matched of kind: %s", gvk.String()))
}
}
if err != nil {
return append(testErrors, err)
}

expectedObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(expected)
if err != nil {
Expand Down

0 comments on commit 45c9e39

Please sign in to comment.