specify sharepoint restore libraries (#3801)

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🤖 Supportability/Tests

#### Test Plan

- [x] 💚 E2E
This commit is contained in:
Keepers 2023-07-13 19:21:53 -06:00 committed by GitHub
parent 4d4f5dc934
commit e60610193c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 14 deletions

View File

@ -1180,7 +1180,10 @@ func getSelectorWith(
case path.SharePointService:
if forRestore {
return selectors.NewSharePointRestore(resourceOwners).Selector
sel := selectors.NewSharePointRestore(resourceOwners)
sel.Include(sel.Library(tconfig.LibraryDocuments), sel.Library(tconfig.LibraryMoreDocuments))
return sel.Selector
}
return selectors.NewSharePointBackup(resourceOwners).Selector

View File

@ -350,11 +350,6 @@ func setupSharePointBackup(
evmock.NewBus())
require.NoError(t, err, clues.ToCore(err))
spPgr := ctrl.AC.Drives().NewSiteDrivePager(owner, []string{"id", "name"})
drives, err := api.GetAllDrives(ctx, spPgr, true, 3)
require.NoError(t, err, clues.ToCore(err))
err = bo.Run(ctx)
require.NoError(t, err, clues.ToCore(err))
require.NotEmpty(t, bo.Results.BackupID)
@ -362,12 +357,14 @@ func setupSharePointBackup(
return bupResults{
selectorResourceOwners: sites,
backupID: bo.Results.BackupID,
// Discount metadata files (1 delta, 1 prev path)
// Discount metadata files (2: 1 delta, 1 prev path)
// assume only one folder, and therefore 1 dirmeta per drive
// assume only one file in each folder, and therefore 1 meta per drive.
// These meta files are used to aid restore, but are not themselves
// (2 drives: documents and more documents)
// assume only one file in each folder, and therefore 1 meta per drive
// (2 drives: documents and more documents)
// Meta files are used to aid restore, but are not themselves
// restored (ie: counted as writes).
items: bo.Results.ItemsWritten - 2 - len(drives) - len(drives),
items: bo.Results.ItemsWritten - 6,
ctrl: ctrl,
}
}
@ -398,7 +395,7 @@ func (suite *RestoreOpIntegrationSuite) TestRestore_Run() {
restoreCfg: control.DefaultRestoreConfig(dttm.SafeForTesting),
getSelector: func(t *testing.T, owners []string) selectors.Selector {
rsel := selectors.NewSharePointRestore(owners)
rsel.Include(rsel.AllData())
rsel.Include(rsel.Library(tconfig.LibraryDocuments), rsel.Library(tconfig.LibraryMoreDocuments))
return rsel.Selector
},

View File

@ -0,0 +1,8 @@
package tconfig
// SharePoint
const (
// commonly used drive names
LibraryDocuments = "Documents"
LibraryMoreDocuments = "More Documents"
)

View File

@ -329,18 +329,20 @@ func CheckBackupDetails(
}
// Compare folders.
// Have result first since it may be a Subset call.
check(
t,
maps.Keys(expect.Sets[set].Locations),
maps.Keys(result.Sets[set].Locations),
maps.Keys(expect.Sets[set].Locations),
"results in %s missing expected location", set)
// Compare items in folders.
for lr, items := range expect.Sets[set].Locations {
// Have result first since it may be a Subset call.
check(
t,
maps.Keys(items),
maps.Keys(result.Sets[set].Locations[lr]),
maps.Keys(items),
"results in set %s location %s missing expected item",
set,
lr)

View File

@ -1,6 +1,8 @@
package testdata
import "github.com/alcionai/corso/src/pkg/selectors"
import (
"github.com/alcionai/corso/src/pkg/selectors"
)
// SharePointBackupFolderScope is the standard folder scope that should be used
// in integration backups with sharepoint.