From 51b3f25311472fd19f970602ea7c185f034d5f00 Mon Sep 17 00:00:00 2001 From: neha_gupta Date: Wed, 12 Apr 2023 20:21:15 +0530 Subject: [PATCH] [Sanity test]- skip owner permission in onedrive restore check (#3103) for Sanity test - skip owner permission in onedrive restore check #### Does this PR need a docs update or release note? - [ ] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [ ] :no_entry: No #### Type of change - [ ] :sunflower: Feature - [ ] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Supportability/Tests - [ ] :computer: CI/Deployment - [ ] :broom: Tech Debt/Cleanup #### Issue(s) * https://github.com/alcionai/corso/issues/3081 #### Test Plan - [ ] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- .github/workflows/sanity-test.yaml | 2 ++ src/cmd/sanity_test/sanity_tests.go | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sanity-test.yaml b/.github/workflows/sanity-test.yaml index dfefd8c04..b9086b21e 100644 --- a/.github/workflows/sanity-test.yaml +++ b/.github/workflows/sanity-test.yaml @@ -51,6 +51,8 @@ jobs: - run: mkdir test_results + - run: mkdir testlog + # run the tests - name: Version Test run: | diff --git a/src/cmd/sanity_test/sanity_tests.go b/src/cmd/sanity_test/sanity_tests.go index 40c4acbfc..63d560066 100644 --- a/src/cmd/sanity_test/sanity_tests.go +++ b/src/cmd/sanity_test/sanity_tests.go @@ -354,7 +354,7 @@ func checkOnedriveRestoration( getRestoreData(ctx, client, *drive.GetId(), restoreFolderID, restoreFile, restoreFolderPermission, startTime) for folderName, permissions := range folderPermission { - logger.Ctx(ctx).Info("checking for folder: %s \n", folderName) + logger.Ctx(ctx).Info("checking for folder: ", folderName, "\n") fmt.Printf("checking for folder: %s \n", folderName) restoreFolderPerm := restoreFolderPermission[folderName] @@ -488,17 +488,24 @@ func permissionIn( } var ( - gv2 = perm.GetGrantedToV2() - perInfo = permissionInfo{} + gv2 = perm.GetGrantedToV2() + perInfo = permissionInfo{} + entityID string ) if gv2.GetUser() != nil { - perInfo.entityID = ptr.Val(gv2.GetUser().GetId()) + entityID = ptr.Val(gv2.GetUser().GetId()) } else if gv2.GetGroup() != nil { - perInfo.entityID = ptr.Val(gv2.GetGroup().GetId()) + entityID = ptr.Val(gv2.GetGroup().GetId()) } - perInfo.roles = perm.GetRoles() + roles := perm.GetRoles() + for _, role := range roles { + if role != "owner" { + perInfo.entityID = entityID + perInfo.roles = append(perInfo.roles, role) + } + } slices.Sort(perInfo.roles)