GC: Backup: CI: Stabilize Iterator test (#1079)
## Description CI test timing during times of high activity. Reduced test suite to cover Inbox and adjusted outputs accordingly. <!-- Insert PR description--> ## Type of change - [x] 🐛 Bugfix ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> *closes #1078<issue> ## Test Plan - [x] ⚡ Unit test
This commit is contained in:
parent
0724db938c
commit
a5140d20b2
@ -74,32 +74,19 @@ func (suite *ExchangeIteratorSuite) TestIterativeFunctions() {
|
|||||||
var (
|
var (
|
||||||
ctx = context.Background()
|
ctx = context.Background()
|
||||||
t = suite.T()
|
t = suite.T()
|
||||||
mailScope, contactScope, eventScope selectors.ExchangeScope
|
mailScope, contactScope, eventScope []selectors.ExchangeScope
|
||||||
userID = tester.M365UserID(t)
|
userID = tester.M365UserID(t)
|
||||||
sel = selectors.NewExchangeBackup()
|
sel = selectors.NewExchangeBackup()
|
||||||
service = loadService(t)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
sel.Include(sel.Users([]string{userID}))
|
|
||||||
|
|
||||||
eb, err := sel.ToExchangeBackup()
|
eb, err := sel.ToExchangeBackup()
|
||||||
require.NoError(suite.T(), err)
|
require.NoError(suite.T(), err)
|
||||||
|
|
||||||
scopes := eb.Scopes()
|
contactScope = sel.ContactFolders([]string{userID}, []string{DefaultContactFolder})
|
||||||
|
eventScope = sel.EventCalendars([]string{userID}, []string{DefaultCalendar})
|
||||||
|
mailScope = sel.MailFolders([]string{userID}, []string{DefaultMailFolder})
|
||||||
|
|
||||||
for _, scope := range scopes {
|
eb.Include(contactScope, eventScope, mailScope)
|
||||||
if scope.IncludesCategory(selectors.ExchangeContactFolder) {
|
|
||||||
contactScope = scope
|
|
||||||
}
|
|
||||||
|
|
||||||
if scope.IncludesCategory(selectors.ExchangeMail) {
|
|
||||||
mailScope = scope
|
|
||||||
}
|
|
||||||
|
|
||||||
if scope.IncludesCategory(selectors.ExchangeEvent) {
|
|
||||||
eventScope = scope
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@ -113,7 +100,7 @@ func (suite *ExchangeIteratorSuite) TestIterativeFunctions() {
|
|||||||
name: "Mail Iterative Check",
|
name: "Mail Iterative Check",
|
||||||
queryFunction: GetAllMessagesForUser,
|
queryFunction: GetAllMessagesForUser,
|
||||||
iterativeFunction: IterateSelectAllDescendablesForCollections,
|
iterativeFunction: IterateSelectAllDescendablesForCollections,
|
||||||
scope: mailScope,
|
scope: mailScope[0],
|
||||||
transformer: models.CreateMessageCollectionResponseFromDiscriminatorValue,
|
transformer: models.CreateMessageCollectionResponseFromDiscriminatorValue,
|
||||||
folderNames: map[string]struct{}{
|
folderNames: map[string]struct{}{
|
||||||
DefaultMailFolder: {},
|
DefaultMailFolder: {},
|
||||||
@ -123,41 +110,40 @@ func (suite *ExchangeIteratorSuite) TestIterativeFunctions() {
|
|||||||
name: "Contacts Iterative Check",
|
name: "Contacts Iterative Check",
|
||||||
queryFunction: GetAllContactsForUser,
|
queryFunction: GetAllContactsForUser,
|
||||||
iterativeFunction: IterateSelectAllDescendablesForCollections,
|
iterativeFunction: IterateSelectAllDescendablesForCollections,
|
||||||
scope: contactScope,
|
scope: contactScope[0],
|
||||||
transformer: models.CreateContactFromDiscriminatorValue,
|
transformer: models.CreateContactFromDiscriminatorValue,
|
||||||
}, {
|
}, {
|
||||||
name: "Contact Folder Traversal",
|
name: "Contact Folder Traversal",
|
||||||
queryFunction: GetAllContactFolderNamesForUser,
|
queryFunction: GetAllContactFolderNamesForUser,
|
||||||
iterativeFunction: IterateSelectAllContactsForCollections,
|
iterativeFunction: IterateSelectAllContactsForCollections,
|
||||||
scope: contactScope,
|
scope: contactScope[0],
|
||||||
transformer: models.CreateContactFolderCollectionResponseFromDiscriminatorValue,
|
transformer: models.CreateContactFolderCollectionResponseFromDiscriminatorValue,
|
||||||
}, {
|
}, {
|
||||||
name: "Events Iterative Check",
|
name: "Events Iterative Check",
|
||||||
queryFunction: GetAllCalendarNamesForUser,
|
queryFunction: GetAllCalendarNamesForUser,
|
||||||
iterativeFunction: IterateSelectAllEventsFromCalendars,
|
iterativeFunction: IterateSelectAllEventsFromCalendars,
|
||||||
scope: eventScope,
|
scope: eventScope[0],
|
||||||
transformer: models.CreateCalendarCollectionResponseFromDiscriminatorValue,
|
transformer: models.CreateCalendarCollectionResponseFromDiscriminatorValue,
|
||||||
}, {
|
}, {
|
||||||
name: "Folder Iterative Check Mail",
|
name: "Folder Iterative Check Mail",
|
||||||
queryFunction: GetAllFolderNamesForUser,
|
queryFunction: GetAllFolderNamesForUser,
|
||||||
iterativeFunction: IterateFilterContainersForCollections,
|
iterativeFunction: IterateFilterContainersForCollections,
|
||||||
scope: mailScope,
|
scope: mailScope[0],
|
||||||
transformer: models.CreateMailFolderCollectionResponseFromDiscriminatorValue,
|
transformer: models.CreateMailFolderCollectionResponseFromDiscriminatorValue,
|
||||||
folderNames: map[string]struct{}{
|
folderNames: map[string]struct{}{
|
||||||
DefaultMailFolder: {},
|
DefaultMailFolder: {},
|
||||||
"Sent Items": {},
|
|
||||||
"Deleted Items": {},
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
name: "Folder Iterative Check Contacts",
|
name: "Folder Iterative Check Contacts",
|
||||||
queryFunction: GetAllContactFolderNamesForUser,
|
queryFunction: GetAllContactFolderNamesForUser,
|
||||||
iterativeFunction: IterateFilterContainersForCollections,
|
iterativeFunction: IterateFilterContainersForCollections,
|
||||||
scope: contactScope,
|
scope: contactScope[0],
|
||||||
transformer: models.CreateContactFolderCollectionResponseFromDiscriminatorValue,
|
transformer: models.CreateContactFolderCollectionResponseFromDiscriminatorValue,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
suite.T().Run(test.name, func(t *testing.T) {
|
suite.T().Run(test.name, func(t *testing.T) {
|
||||||
|
service := loadService(t)
|
||||||
response, err := test.queryFunction(ctx, service, userID)
|
response, err := test.queryFunction(ctx, service, userID)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
// Create Iterator
|
// Create Iterator
|
||||||
@ -201,8 +187,8 @@ func (suite *ExchangeIteratorSuite) TestIterativeFunctions() {
|
|||||||
|
|
||||||
for _, c := range collections {
|
for _, c := range collections {
|
||||||
require.NotEmpty(t, c.FullPath().Folder())
|
require.NotEmpty(t, c.FullPath().Folder())
|
||||||
|
|
||||||
folder := c.FullPath().Folder()
|
folder := c.FullPath().Folder()
|
||||||
|
|
||||||
if _, ok := test.folderNames[folder]; ok {
|
if _, ok := test.folderNames[folder]; ok {
|
||||||
delete(test.folderNames, folder)
|
delete(test.folderNames, folder)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user