disable backup of sharepoint lists (#4960)

disable backup of sharepoint lists

#### Does this PR need a docs update or release note?
- [x]  No

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x]  Unit test
- [x] 💚 E2E
This commit is contained in:
Hitesh Pattanayak 2024-01-03 01:11:35 +05:30 committed by GitHub
parent e43fec2de6
commit 4224a98927
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 21 deletions

View File

@ -75,15 +75,18 @@ func SharePointAllowedCategories() map[string]struct{} {
func AddCategories(sel *selectors.SharePointBackup, cats []string) *selectors.SharePointBackup { func AddCategories(sel *selectors.SharePointBackup, cats []string) *selectors.SharePointBackup {
if len(cats) == 0 { if len(cats) == 0 {
sel.Include(sel.LibraryFolders(selectors.Any()), sel.Lists(selectors.Any())) // backup of sharepoint lists not enabled yet
// sel.Include(sel.LibraryFolders(selectors.Any()), sel.Lists(selectors.Any()))
sel.Include(sel.LibraryFolders(selectors.Any()))
} }
for _, d := range cats { for _, d := range cats {
switch d { switch d {
// backup of sharepoint lists not enabled yet
// case flags.DataLists:
// sel.Include(sel.Lists(selectors.Any()))
case flags.DataLibraries: case flags.DataLibraries:
sel.Include(sel.LibraryFolders(selectors.Any())) sel.Include(sel.LibraryFolders(selectors.Any()))
case flags.DataLists:
sel.Include(sel.Lists(selectors.Any()))
} }
} }

View File

@ -378,35 +378,36 @@ func (suite *SharePointUtilsSuite) TestValidateSharePointRestoreFlags() {
} }
} }
// [TODO] uncomment the test cases once sharepoint list backup is enabled
func (suite *SharePointUtilsSuite) TestAddSharepointCategories() { func (suite *SharePointUtilsSuite) TestAddSharepointCategories() {
table := []struct { table := []struct {
name string name string
cats []string cats []string
expectScopeLen int expectScopeLen int
}{ }{
{ // {
name: "none", // name: "none",
cats: []string{}, // cats: []string{},
expectScopeLen: 2, // expectScopeLen: 2,
}, // },
{ {
name: "libraries", name: "libraries",
cats: []string{flags.DataLibraries}, cats: []string{flags.DataLibraries},
expectScopeLen: 1, expectScopeLen: 1,
}, },
{ // {
name: "lists", // name: "lists",
cats: []string{flags.DataLists}, // cats: []string{flags.DataLists},
expectScopeLen: 1, // expectScopeLen: 1,
}, // },
{ // {
name: "all allowed", // name: "all allowed",
cats: []string{ // cats: []string{
flags.DataLibraries, // flags.DataLibraries,
flags.DataLists, // flags.DataLists,
}, // },
expectScopeLen: 2, // expectScopeLen: 2,
}, // },
{ {
name: "bad inputs", name: "bad inputs",
cats: []string{"foo"}, cats: []string{"foo"},