diff --git a/src/internal/m365/onedrive/collection_test.go b/src/internal/m365/onedrive/collection_test.go index 4d49c92d9..ba621caf7 100644 --- a/src/internal/m365/onedrive/collection_test.go +++ b/src/internal/m365/onedrive/collection_test.go @@ -613,7 +613,8 @@ type mockURLCache struct { func (muc *mockURLCache) getItemProperties( ctx context.Context, - itemID string) (itemProps, error) { + itemID string, +) (itemProps, error) { return muc.Get(ctx, itemID) } diff --git a/src/internal/m365/onedrive/collections.go b/src/internal/m365/onedrive/collections.go index 08ad3a346..dedf3557b 100644 --- a/src/internal/m365/onedrive/collections.go +++ b/src/internal/m365/onedrive/collections.go @@ -391,7 +391,6 @@ func (c *Collections) Get( err = c.addURLCacheToDriveCollections( ictx, driveID, - c.handler.ItemPager(driveID, "", api.DriveItemSelectDefault()), errs) if err != nil { return nil, err @@ -459,17 +458,18 @@ func (c *Collections) Get( return collections, canUsePreviousBackup, nil } +// addURLCacheToDriveCollections adds a URL cache to all collections belonging to +// a drive. func (c *Collections) addURLCacheToDriveCollections( ctx context.Context, driveID string, - pager api.DriveItemEnumerator, errs *fault.Bus, ) error { uc, err := newURLCache( driveID, urlCacheRefreshInterval, errs, - pager) + c.handler.ItemPager(driveID, "", api.DriveItemSelectDefault())) if err != nil { return err } diff --git a/src/internal/m365/onedrive/collections_test.go b/src/internal/m365/onedrive/collections_test.go index 6d1163c8c..f32bdd155 100644 --- a/src/internal/m365/onedrive/collections_test.go +++ b/src/internal/m365/onedrive/collections_test.go @@ -2692,7 +2692,6 @@ func (suite *OneDriveCollectionsUnitSuite) TestURLCacheIntegration() { prevDelta string err error }{ - { name: "cache is attached", }, @@ -2704,8 +2703,11 @@ func (suite *OneDriveCollectionsUnitSuite) TestURLCacheIntegration() { ctx, flush := tester.NewContext() defer flush() + mbh := mock.DefaultOneDriveBH() + mbh.ItemPagerV = map[string]api.DriveItemEnumerator{} + c := NewCollections( - &itemBackupHandler{api.Drives{}}, + mbh, "test-tenant", "test-user", testFolderMatcher{(&selectors.OneDriveBackup{}).Folders(selectors.Any())[0]}, @@ -2737,7 +2739,6 @@ func (suite *OneDriveCollectionsUnitSuite) TestURLCacheIntegration() { err := c.addURLCacheToDriveCollections( ctx, driveID, - &mockItemPager{}, fault.New(true)) require.NoError(t, err, clues.ToCore(err))