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 (
|
||||
ctx = context.Background()
|
||||
t = suite.T()
|
||||
mailScope, contactScope, eventScope selectors.ExchangeScope
|
||||
mailScope, contactScope, eventScope []selectors.ExchangeScope
|
||||
userID = tester.M365UserID(t)
|
||||
sel = selectors.NewExchangeBackup()
|
||||
service = loadService(t)
|
||||
)
|
||||
|
||||
sel.Include(sel.Users([]string{userID}))
|
||||
|
||||
eb, err := sel.ToExchangeBackup()
|
||||
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 {
|
||||
if scope.IncludesCategory(selectors.ExchangeContactFolder) {
|
||||
contactScope = scope
|
||||
}
|
||||
|
||||
if scope.IncludesCategory(selectors.ExchangeMail) {
|
||||
mailScope = scope
|
||||
}
|
||||
|
||||
if scope.IncludesCategory(selectors.ExchangeEvent) {
|
||||
eventScope = scope
|
||||
}
|
||||
}
|
||||
eb.Include(contactScope, eventScope, mailScope)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@ -113,7 +100,7 @@ func (suite *ExchangeIteratorSuite) TestIterativeFunctions() {
|
||||
name: "Mail Iterative Check",
|
||||
queryFunction: GetAllMessagesForUser,
|
||||
iterativeFunction: IterateSelectAllDescendablesForCollections,
|
||||
scope: mailScope,
|
||||
scope: mailScope[0],
|
||||
transformer: models.CreateMessageCollectionResponseFromDiscriminatorValue,
|
||||
folderNames: map[string]struct{}{
|
||||
DefaultMailFolder: {},
|
||||
@ -123,41 +110,40 @@ func (suite *ExchangeIteratorSuite) TestIterativeFunctions() {
|
||||
name: "Contacts Iterative Check",
|
||||
queryFunction: GetAllContactsForUser,
|
||||
iterativeFunction: IterateSelectAllDescendablesForCollections,
|
||||
scope: contactScope,
|
||||
scope: contactScope[0],
|
||||
transformer: models.CreateContactFromDiscriminatorValue,
|
||||
}, {
|
||||
name: "Contact Folder Traversal",
|
||||
queryFunction: GetAllContactFolderNamesForUser,
|
||||
iterativeFunction: IterateSelectAllContactsForCollections,
|
||||
scope: contactScope,
|
||||
scope: contactScope[0],
|
||||
transformer: models.CreateContactFolderCollectionResponseFromDiscriminatorValue,
|
||||
}, {
|
||||
name: "Events Iterative Check",
|
||||
queryFunction: GetAllCalendarNamesForUser,
|
||||
iterativeFunction: IterateSelectAllEventsFromCalendars,
|
||||
scope: eventScope,
|
||||
scope: eventScope[0],
|
||||
transformer: models.CreateCalendarCollectionResponseFromDiscriminatorValue,
|
||||
}, {
|
||||
name: "Folder Iterative Check Mail",
|
||||
queryFunction: GetAllFolderNamesForUser,
|
||||
iterativeFunction: IterateFilterContainersForCollections,
|
||||
scope: mailScope,
|
||||
scope: mailScope[0],
|
||||
transformer: models.CreateMailFolderCollectionResponseFromDiscriminatorValue,
|
||||
folderNames: map[string]struct{}{
|
||||
DefaultMailFolder: {},
|
||||
"Sent Items": {},
|
||||
"Deleted Items": {},
|
||||
},
|
||||
}, {
|
||||
name: "Folder Iterative Check Contacts",
|
||||
queryFunction: GetAllContactFolderNamesForUser,
|
||||
iterativeFunction: IterateFilterContainersForCollections,
|
||||
scope: contactScope,
|
||||
scope: contactScope[0],
|
||||
transformer: models.CreateContactFolderCollectionResponseFromDiscriminatorValue,
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
suite.T().Run(test.name, func(t *testing.T) {
|
||||
service := loadService(t)
|
||||
response, err := test.queryFunction(ctx, service, userID)
|
||||
require.NoError(t, err)
|
||||
// Create Iterator
|
||||
@ -201,8 +187,8 @@ func (suite *ExchangeIteratorSuite) TestIterativeFunctions() {
|
||||
|
||||
for _, c := range collections {
|
||||
require.NotEmpty(t, c.FullPath().Folder())
|
||||
|
||||
folder := c.FullPath().Folder()
|
||||
|
||||
if _, ok := test.folderNames[folder]; ok {
|
||||
delete(test.folderNames, folder)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user