remove cli support for exchange item msoft id lookup (#3316)
removes the microsoft item ID from the exchange pathValues set when using only-name selector configuration. This is the standard config for the cli, thus this removes the ability to filter exchange items from the cli by using their m365 id. --- #### Does this PR need a docs update or release note? - [x] ✅ Yes, it's included #### Type of change - [x] 🧹 Tech Debt/Cleanup #### Issue(s) * #3313 #### Test Plan - [x] 💪 Manual - [x] ⚡ Unit test
This commit is contained in:
parent
5b9cd69e29
commit
e67e5be977
@ -13,8 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Graph requests now automatically retry in case of a Bad Gateway or Gateway Timeout.
|
||||
- POST Retries following certain status codes (500, 502, 504) will re-use the post body instead of retrying with a no-content request.
|
||||
- Fix nil pointer exception when running an incremental backup on SharePoint where the base backup used an older index data format.
|
||||
- --user and --mailbox flags (already not supported) have been removed from CLI examples for details and restore commands.
|
||||
- --user and --mailbox flags have been removed from CLI examples for details and restore commands (they were already not supported, this only updates the docs).
|
||||
- Improve restore time on large restores by optimizing how items are loaded from the remote repository.
|
||||
- Remove exchange item filtering based on m365 item ID via the CLI.
|
||||
|
||||
## [v0.7.0] (beta) - 2023-05-02
|
||||
|
||||
|
||||
16
src/cli/utils/testdata/opts.go
vendored
16
src/cli/utils/testdata/opts.go
vendored
@ -198,13 +198,6 @@ var (
|
||||
EmailReceivedBefore: dttm.Format(testdata.Time1.Add(time.Second)),
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "MailItemRef",
|
||||
Expected: []details.Entry{testdata.ExchangeEmailItems[0]},
|
||||
Opts: utils.ExchangeOpts{
|
||||
Email: []string{testdata.ExchangeEmailItems[0].ItemRef},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "MailShortRef",
|
||||
Expected: []details.Entry{testdata.ExchangeEmailItems[0]},
|
||||
@ -212,6 +205,15 @@ var (
|
||||
Email: []string{testdata.ExchangeEmailItemPath1.RR.ShortRef()},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "BadMailItemRef",
|
||||
// no matches are expected, since exchange ItemRefs
|
||||
// are not matched when using the CLI's selectors.
|
||||
Expected: []details.Entry{},
|
||||
Opts: utils.ExchangeOpts{
|
||||
Email: []string{testdata.ExchangeEmailItems[0].ItemRef},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "MultipleMailShortRef",
|
||||
Expected: []details.Entry{
|
||||
|
||||
@ -617,6 +617,15 @@ func (ec exchangeCategory) pathValues(
|
||||
item = repo.Item()
|
||||
}
|
||||
|
||||
items := []string{ent.ShortRef, item}
|
||||
|
||||
// only include the item ID when the user is NOT matching
|
||||
// item names. Exchange data does not contain an item name,
|
||||
// only an ID, and we don't want to mix up the two.
|
||||
if cfg.OnlyMatchItemNames {
|
||||
items = []string{ent.ShortRef}
|
||||
}
|
||||
|
||||
// Will hit the if-condition when we're at a top-level folder, but we'll get
|
||||
// the same result when we extract from the RepoRef.
|
||||
folder := ent.LocationRef
|
||||
@ -626,7 +635,7 @@ func (ec exchangeCategory) pathValues(
|
||||
|
||||
result := map[categorizer][]string{
|
||||
folderCat: {folder},
|
||||
itemCat: {item, ent.ShortRef},
|
||||
itemCat: items,
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
||||
@ -1492,48 +1492,74 @@ func (suite *ExchangeSelectorSuite) TestExchangeCategory_leafCat() {
|
||||
func (suite *ExchangeSelectorSuite) TestExchangeCategory_PathValues() {
|
||||
t := suite.T()
|
||||
|
||||
contactPath := stubPath(t, "user", []string{"cfolder.d", "contactitem.d"}, path.ContactsCategory)
|
||||
contactLoc := stubPath(t, "user", []string{"cfolder", "contactitem"}, path.ContactsCategory)
|
||||
contactMap := map[categorizer][]string{
|
||||
ExchangeContactFolder: {contactLoc.Folder(false)},
|
||||
ExchangeContact: {contactPath.Item(), "short"},
|
||||
}
|
||||
eventPath := stubPath(t, "user", []string{"ecalendar.d", "eventitem.d"}, path.EventsCategory)
|
||||
eventLoc := stubPath(t, "user", []string{"ecalendar", "eventitem"}, path.EventsCategory)
|
||||
eventMap := map[categorizer][]string{
|
||||
ExchangeEventCalendar: {eventLoc.Folder(false)},
|
||||
ExchangeEvent: {eventPath.Item(), "short"},
|
||||
}
|
||||
mailPath := stubPath(t, "user", []string{"mfolder.d", "mailitem.d"}, path.EmailCategory)
|
||||
mailLoc := stubPath(t, "user", []string{"mfolder", "mailitem"}, path.EmailCategory)
|
||||
mailMap := map[categorizer][]string{
|
||||
ExchangeMailFolder: {mailLoc.Folder(false)},
|
||||
ExchangeMail: {mailPath.Item(), "short"},
|
||||
}
|
||||
var (
|
||||
contactPath = stubPath(t, "u", []string{"cfolder.d", "contactitem.d"}, path.ContactsCategory)
|
||||
contactLoc = stubPath(t, "u", []string{"cfolder", "contactitem"}, path.ContactsCategory)
|
||||
contactMap = map[categorizer][]string{
|
||||
ExchangeContactFolder: {contactLoc.Folder(false)},
|
||||
ExchangeContact: {contactPath.Item(), "contact-short"},
|
||||
}
|
||||
contactOnlyNameMap = map[categorizer][]string{
|
||||
ExchangeContactFolder: {contactLoc.Folder(false)},
|
||||
ExchangeContact: {"contact-short"},
|
||||
}
|
||||
eventPath = stubPath(t, "u", []string{"ecalendar.d", "eventitem.d"}, path.EventsCategory)
|
||||
eventLoc = stubPath(t, "u", []string{"ecalendar", "eventitem"}, path.EventsCategory)
|
||||
eventMap = map[categorizer][]string{
|
||||
ExchangeEventCalendar: {eventLoc.Folder(false)},
|
||||
ExchangeEvent: {eventPath.Item(), "event-short"},
|
||||
}
|
||||
eventOnlyNameMap = map[categorizer][]string{
|
||||
ExchangeEventCalendar: {eventLoc.Folder(false)},
|
||||
ExchangeEvent: {"event-short"},
|
||||
}
|
||||
mailPath = stubPath(t, "u", []string{"mfolder.d", "mailitem.d"}, path.EmailCategory)
|
||||
mailLoc = stubPath(t, "u", []string{"mfolder", "mailitem"}, path.EmailCategory)
|
||||
mailMap = map[categorizer][]string{
|
||||
ExchangeMailFolder: {mailLoc.Folder(false)},
|
||||
ExchangeMail: {mailPath.Item(), "mail-short"},
|
||||
}
|
||||
mailOnlyNameMap = map[categorizer][]string{
|
||||
ExchangeMailFolder: {mailLoc.Folder(false)},
|
||||
ExchangeMail: {"mail-short"},
|
||||
}
|
||||
)
|
||||
|
||||
table := []struct {
|
||||
cat exchangeCategory
|
||||
path path.Path
|
||||
loc path.Path
|
||||
expect map[categorizer][]string
|
||||
cat exchangeCategory
|
||||
path path.Path
|
||||
loc path.Path
|
||||
short string
|
||||
expect map[categorizer][]string
|
||||
expectOnlyName map[categorizer][]string
|
||||
}{
|
||||
{ExchangeContact, contactPath, contactLoc, contactMap},
|
||||
{ExchangeEvent, eventPath, eventLoc, eventMap},
|
||||
{ExchangeMail, mailPath, mailLoc, mailMap},
|
||||
{ExchangeContact, contactPath, contactLoc, "contact-short", contactMap, contactOnlyNameMap},
|
||||
{ExchangeEvent, eventPath, eventLoc, "event-short", eventMap, eventOnlyNameMap},
|
||||
{ExchangeMail, mailPath, mailLoc, "mail-short", mailMap, mailOnlyNameMap},
|
||||
}
|
||||
for _, test := range table {
|
||||
suite.Run(string(test.cat), func() {
|
||||
t := suite.T()
|
||||
ent := details.Entry{
|
||||
RepoRef: test.path.String(),
|
||||
ShortRef: "short",
|
||||
ShortRef: test.short,
|
||||
LocationRef: test.loc.Folder(true),
|
||||
ItemRef: test.path.Item(),
|
||||
}
|
||||
|
||||
pvs, err := test.cat.pathValues(test.path, ent, Config{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, test.expect, pvs)
|
||||
|
||||
for k := range test.expect {
|
||||
assert.ElementsMatch(t, test.expect[k], pvs[k])
|
||||
}
|
||||
|
||||
pvs, err = test.cat.pathValues(test.path, ent, Config{OnlyMatchItemNames: true})
|
||||
require.NoError(t, err)
|
||||
|
||||
for k := range test.expectOnlyName {
|
||||
assert.ElementsMatch(t, test.expectOnlyName[k], pvs[k], k)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user