diff --git a/api/types/resource.go b/api/types/resource.go index 18c3497929b0b..f7465a84e8ba0 100644 --- a/api/types/resource.go +++ b/api/types/resource.go @@ -140,11 +140,13 @@ type EnrichedResource struct { } // EnrichedResources is a wrapper of []*EnrichedResource. +// A EnrichedResource is a [ResourceWithLabels] wrapped with additional +// user-specific information. type EnrichedResources []*EnrichedResource // ToResourcesWithLabels converts to ResourcesWithLabels. func (r EnrichedResources) ToResourcesWithLabels() ResourcesWithLabels { - ret := make(ResourcesWithLabels, len(r)) + ret := make(ResourcesWithLabels, 0, len(r)) for _, resource := range r { ret = append(ret, resource.ResourceWithLabels) } diff --git a/lib/services/unified_resource_test.go b/lib/services/unified_resource_test.go index dd86edce00d30..344a134e13911 100644 --- a/lib/services/unified_resource_test.go +++ b/lib/services/unified_resource_test.go @@ -174,7 +174,7 @@ func TestUnifiedResourceWatcher(t *testing.T) { // we expect each of the resources above to exist expectedRes := []types.ResourceWithLabels{node, app, samlapp, dbServer, win, - gitServer,gitServer2, + gitServer, gitServer2, types.Resource153ToUnifiedResource(icAcct)} assert.Eventually(t, func() bool { res, err = w.GetUnifiedResources(ctx) @@ -212,7 +212,7 @@ func TestUnifiedResourceWatcher(t *testing.T) { // this should include the updated node, and shouldn't have any apps included expectedRes = []types.ResourceWithLabels{nodeUpdated, samlapp, dbServer, win, - gitServer,gitServer2, + gitServer, gitServer2, types.Resource153ToUnifiedResource(icAcct)} assert.Eventually(t, func() bool { @@ -387,7 +387,6 @@ func TestUnifiedResourceWatcher_DeleteEvent(t *testing.T) { icAcct := newIdentityCenterAccount(t, ctx, clt) - // add git server gitServer := newGitServer(t, "my-org") _, err = clt.CreateGitServer(ctx, gitServer)