diff --git a/core/provider/service.go b/core/provider/service.go index b9017fb7..ee395e34 100644 --- a/core/provider/service.go +++ b/core/provider/service.go @@ -624,7 +624,7 @@ func (s *Service) fetchNewResources(ctx context.Context, p *domain.Provider) ([] func (s *Service) compareResources(ctx context.Context, existingResources map[string]*domain.Resource, newResources []*domain.Resource) []*domain.Resource { // (*existingProviderResources)[newResource.GlobalURN] = true - var res []*domain.Resource + res := []*domain.Resource{} for _, new := range newResources { new.Children = s.compareResources(ctx, existingResources, new.Children) diff --git a/core/provider/service_test.go b/core/provider/service_test.go index ee212224..d28a21f0 100644 --- a/core/provider/service_test.go +++ b/core/provider/service_test.go @@ -135,7 +135,7 @@ func (s *ServiceTestSuite) TestCreate() { ProviderURN: p.URN, }).Return([]*domain.Resource{}, nil).Once() s.mockProvider.On("GetResources", mockCtx, p.Config).Return(expectedResources, nil).Once() - s.mockResourceService.On("BulkUpsert", mock.Anything, []*domain.Resource(nil)).Return(nil).Once() + s.mockResourceService.On("BulkUpsert", mock.Anything, expectedResources).Return(nil).Once() actualError := s.service.Create(context.Background(), p)