Skip to content

Commit

Permalink
Fix issue where actuals was not being assigned correctly
Browse files Browse the repository at this point in the history
Signed-off-by: jtucci <[email protected]>
  • Loading branch information
jtucci committed Nov 3, 2023
1 parent 45c9e39 commit 06bd1f1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/test/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ func (s *Step) CheckResource(expected runtime.Object, namespace string) []error
gvk := expected.GetObjectKind().GroupVersionKind()

actuals := []unstructured.Unstructured{}

if name != "" {
actual := unstructured.Unstructured{}
actual.SetGroupVersionKind(gvk)
Expand All @@ -291,23 +290,22 @@ func (s *Step) CheckResource(expected runtime.Object, namespace string) []error
if err != nil {
return append(testErrors, err)
}
actuals, err := list(cl, gvk, namespace, m.GetLabels())
matches, err := list(cl, gvk, namespace, m.GetLabels())
if err != nil {
return append(testErrors, err)
}
if len(actuals) == 0 {
if len(matches) == 0 {
testErrors = append(testErrors, fmt.Errorf("no resources matched of kind: %s", gvk.String()))
}
actuals = append(actuals, matches...)
}

expectedObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(expected)
if err != nil {
return append(testErrors, err)
}

for _, actual := range actuals {
actual := actual

tmpTestErrors := []error{}

if err := testutils.IsSubset(expectedObj, actual.UnstructuredContent()); err != nil {
Expand Down

0 comments on commit 06bd1f1

Please sign in to comment.