Fix incremetnal backup tests for Groups

This commit is contained in:
Abin Simon 2023-10-18 17:12:08 +05:30
parent 4a2dc774b3
commit 04c3d202fa
2 changed files with 18 additions and 1 deletions

View File

@ -42,6 +42,8 @@ func (suite *GroupsBackupIntgSuite) SetupSuite() {
func (suite *GroupsBackupIntgSuite) TestBackup_Run_incrementalGroups() {
sel := selectors.NewGroupsRestore([]string{suite.its.group.ID})
// sel.Filter(sel.Site(suite.its.group.RootSite.ID))
ic := func(cs []string) selectors.Selector {
sel.Include(sel.LibraryFolders(cs, selectors.PrefixMatch()))
return sel.Selector

View File

@ -398,6 +398,21 @@ func generateContainerOfItems(
restoreCfg.Location = destFldr
restoreCfg.IncludePermissions = true
if sel.Service == selectors.ServiceGroups {
restoreCfg.SubService.Type = path.SharePointService
restoreCfg.SubService.ID = siteID
}
var protectedResource idname.Provider = sel
// In case of groups, we use the root site as the restore target
if sel.Service == selectors.ServiceGroups {
rootSite, err := ctrl.AC.Sites().GetByID(ctx, siteID, api.CallConfig{})
require.NoError(t, err, clues.ToCore(err))
protectedResource = idname.NewProvider(siteID, ptr.Val(rootSite.GetName()))
}
dataColls := buildCollections(
t,
service,
@ -410,7 +425,7 @@ func generateContainerOfItems(
rcc := inject.RestoreConsumerConfig{
BackupVersion: backupVersion,
Options: opts,
ProtectedResource: sel,
ProtectedResource: protectedResource,
RestoreConfig: restoreCfg,
Selector: sel,
}