From 2a51cc69755ccbc369a8f8ecb7ee379b632e24b1 Mon Sep 17 00:00:00 2001 From: Keepers Date: Wed, 19 Oct 2022 13:39:00 -0600 Subject: [PATCH] investigate users not appearing in test assertions (#1188) ## Description Some minor bugs. Further assurance that users will appear in the test results as expected will require manual curation or addition of data in each user's account. ## Type of change - [x] :bug: Bugfix - [x] :robot: Test ## Issue(s) * #902 ## Test Plan - [x] :muscle: Manual - [x] :green_heart: E2E --- src/pkg/repository/repository_load_test.go | 29 ++++++++++------------ 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/pkg/repository/repository_load_test.go b/src/pkg/repository/repository_load_test.go index 327b78333..5dc0ed0ab 100644 --- a/src/pkg/repository/repository_load_test.go +++ b/src/pkg/repository/repository_load_test.go @@ -22,7 +22,7 @@ import ( "github.com/alcionai/corso/src/pkg/storage" ) -var users = []string{ +var alcUsers = []string{ "AdeleV@8qzvrj.onmicrosoft.com", "AlexW@8qzvrj.onmicrosoft.com", "ashmarks@8qzvrj.onmicrosoft.com", @@ -226,14 +226,14 @@ func runRestoreLoadTest( } // noFolders removes all "folder" category details entries -func noFolders(t *testing.T, des []details.DetailsEntry) []*details.DetailsEntry { +func noFolders(t *testing.T, des []details.DetailsEntry) []details.DetailsEntry { t.Helper() - sansfldr := []*details.DetailsEntry{} + sansfldr := []details.DetailsEntry{} for _, ent := range des { if ent.Folder == nil { - sansfldr = append(sansfldr, &ent) + sansfldr = append(sansfldr, ent) } } @@ -255,33 +255,30 @@ func ensureAllUsersInDetails( ) for _, u := range users { - foundUsers[u] = false userCategories[u] = map[string]struct{}{} } for _, ent := range noFolders(t, ds.Entries) { - p, err := path.FromDataLayerPath(ent.RepoRef, true) - if !assert.NoError(t, err, "converting to path: "+ent.RepoRef) { + e := ent + rr := e.RepoRef + + p, err := path.FromDataLayerPath(rr, true) + if !assert.NoError(t, err, "converting to path: "+rr) { continue } ro := p.ResourceOwner() - if !assert.NotEmpty(t, ro, "resource owner in path: "+ent.RepoRef) { + if !assert.NotEmpty(t, ro, "resource owner in path: "+rr) { continue } ct := p.Category() - if !assert.NotEmpty(t, ro, "category type of path: "+ent.RepoRef) { + if !assert.NotEmpty(t, ro, "category type of path: "+rr) { continue } foundUsers[ro] = true foundCategories[ct.String()] = struct{}{} - - if _, ok := userCategories[ro]; !ok { - userCategories[ro] = map[string]struct{}{} - } - userCategories[ro][ct.String()] = struct{}{} } @@ -334,7 +331,7 @@ func (suite *RepositoryLoadTestExchangeSuite) TestExchange() { t = suite.T() r = suite.repo service = "exchange" - usersUnderTest = users + usersUnderTest = alcUsers all = selectors.Any() ) @@ -470,7 +467,7 @@ func (suite *RepositoryLoadTestOneDriveSuite) TestOneDrive() { t = suite.T() r = suite.repo service = "one_drive" - usersUnderTest = users + usersUnderTest = alcUsers ) // backup