From 4a2dc774b354dbaaa4ba265fbc035f86d942182b Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Tue, 17 Oct 2023 17:24:24 +0530 Subject: [PATCH] Fix runDriveRestoreWithAdvancedOptions --- src/internal/operations/test/group_test.go | 3 +-- src/internal/operations/test/onedrive_test.go | 27 +++++++++---------- .../operations/test/sharepoint_test.go | 3 +-- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/internal/operations/test/group_test.go b/src/internal/operations/test/group_test.go index 06c63efc6..5c3710bba 100644 --- a/src/internal/operations/test/group_test.go +++ b/src/internal/operations/test/group_test.go @@ -222,8 +222,7 @@ func (suite *GroupsRestoreNightlyIntgSuite) TestRestore_Run_groupsWithAdvancedOp suite, suite.its.ac, sel.Selector, - suite.its.group.RootSite.DriveID, - suite.its.group.RootSite.DriveRootFolderID) + suite.its.group.RootSite) } func (suite *GroupsRestoreNightlyIntgSuite) TestRestore_Run_groupsAlternateProtectedResource() { diff --git a/src/internal/operations/test/onedrive_test.go b/src/internal/operations/test/onedrive_test.go index 3f8e01d81..2279274b7 100644 --- a/src/internal/operations/test/onedrive_test.go +++ b/src/internal/operations/test/onedrive_test.go @@ -1015,8 +1015,7 @@ func (suite *OneDriveRestoreNightlyIntgSuite) TestRestore_Run_onedriveWithAdvanc suite, suite.its.ac, sel.Selector, - suite.its.user.DriveID, - suite.its.user.DriveRootFolderID) + suite.its.user) } func runDriveRestoreWithAdvancedOptions( @@ -1024,7 +1023,7 @@ func runDriveRestoreWithAdvancedOptions( suite tester.Suite, ac api.Client, sel selectors.Selector, // both Restore and Backup types work. - driveID, rootFolderID string, + driveFrom ids, ) { ctx, flush := tester.NewContext(t) defer flush() @@ -1053,7 +1052,7 @@ func runDriveRestoreWithAdvancedOptions( // Groups restore needs subservice information if sel.Service == selectors.ServiceGroups { restoreCfg.SubService.Type = path.SharePointService - restoreCfg.SubService.ID = driveID + restoreCfg.SubService.ID = driveFrom.ID } // initial restore @@ -1084,18 +1083,18 @@ func runDriveRestoreWithAdvancedOptions( // get all files in folder, use these as the base // set of files to compare against. - contGC, err := acd.GetFolderByName(ctx, driveID, rootFolderID, restoreCfg.Location) + contGC, err := acd.GetFolderByName(ctx, driveFrom.DriveID, driveFrom.DriveRootFolderID, restoreCfg.Location) require.NoError(t, err, clues.ToCore(err)) // the folder containing the files is a child of the folder created by the restore. - contGC, err = acd.GetFolderByName(ctx, driveID, ptr.Val(contGC.GetId()), selTD.TestFolderName) + contGC, err = acd.GetFolderByName(ctx, driveFrom.DriveID, ptr.Val(contGC.GetId()), selTD.TestFolderName) require.NoError(t, err, clues.ToCore(err)) containerID = ptr.Val(contGC.GetId()) collKeys, err = acd.GetItemsInContainerByCollisionKey( ctx, - driveID, + driveFrom.DriveID, containerID) require.NoError(t, err, clues.ToCore(err)) @@ -1103,7 +1102,7 @@ func runDriveRestoreWithAdvancedOptions( checkRestoreCounts(t, ctr, 0, 0, countItemsInRestore) - fileIDs, err = acd.GetItemIDsInContainer(ctx, driveID, containerID) + fileIDs, err = acd.GetItemIDsInContainer(ctx, driveFrom.DriveID, containerID) require.NoError(t, err, clues.ToCore(err)) }) @@ -1145,14 +1144,14 @@ func runDriveRestoreWithAdvancedOptions( result := filterCollisionKeyResults( t, ctx, - driveID, + driveFrom.DriveID, containerID, GetItemsInContainerByCollisionKeyer[api.DriveItemIDType](acd), collKeys) assert.Len(t, result, 0, "no new items should get added") - currentFileIDs, err := acd.GetItemIDsInContainer(ctx, driveID, containerID) + currentFileIDs, err := acd.GetItemIDsInContainer(ctx, driveFrom.DriveID, containerID) require.NoError(t, err, clues.ToCore(err)) assert.Equal(t, fileIDs, currentFileIDs, "ids are equal") @@ -1201,7 +1200,7 @@ func runDriveRestoreWithAdvancedOptions( result := filterCollisionKeyResults( t, ctx, - driveID, + driveFrom.DriveID, containerID, GetItemsInContainerByCollisionKeyer[api.DriveItemIDType](acd), collKeys) @@ -1212,7 +1211,7 @@ func runDriveRestoreWithAdvancedOptions( assert.NotEqual(t, v, collKeys[k], "replaced items should have new IDs") } - currentFileIDs, err := acd.GetItemIDsInContainer(ctx, driveID, containerID) + currentFileIDs, err := acd.GetItemIDsInContainer(ctx, driveFrom.DriveID, containerID) require.NoError(t, err, clues.ToCore(err)) assert.Equal(t, len(fileIDs), len(currentFileIDs), "count of ids ids are equal") @@ -1266,14 +1265,14 @@ func runDriveRestoreWithAdvancedOptions( result := filterCollisionKeyResults( t, ctx, - driveID, + driveFrom.DriveID, containerID, GetItemsInContainerByCollisionKeyer[api.DriveItemIDType](acd), collKeys) assert.Len(t, result, len(collKeys), "all items should have been added as copies") - currentFileIDs, err := acd.GetItemIDsInContainer(ctx, driveID, containerID) + currentFileIDs, err := acd.GetItemIDsInContainer(ctx, driveFrom.DriveID, containerID) require.NoError(t, err, clues.ToCore(err)) assert.Equal(t, 2*len(fileIDs), len(currentFileIDs), "count of ids should be double from before") diff --git a/src/internal/operations/test/sharepoint_test.go b/src/internal/operations/test/sharepoint_test.go index fa28bb747..14af510c1 100644 --- a/src/internal/operations/test/sharepoint_test.go +++ b/src/internal/operations/test/sharepoint_test.go @@ -209,8 +209,7 @@ func (suite *SharePointRestoreNightlyIntgSuite) TestRestore_Run_sharepointWithAd suite, suite.its.ac, sel.Selector, - suite.its.site.DriveID, - suite.its.site.DriveRootFolderID) + suite.its.site) } func (suite *SharePointRestoreNightlyIntgSuite) TestRestore_Run_sharepointAlternateProtectedResource() {