From f8bfe93261331dea23cae585edb48f846e019378 Mon Sep 17 00:00:00 2001 From: Vaibhav Kamra Date: Thu, 18 Aug 2022 07:19:08 -0700 Subject: [PATCH] Scope restore CLI test (#592) --- src/cli/restore/exchange_integration_test.go | 3 +-- src/internal/connector/exchange/service_functions.go | 6 +++++- src/internal/connector/graph_connector.go | 2 -- src/internal/operations/restore.go | 2 ++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/cli/restore/exchange_integration_test.go b/src/cli/restore/exchange_integration_test.go index b4c5009ab..c24eba8cf 100644 --- a/src/cli/restore/exchange_integration_test.go +++ b/src/cli/restore/exchange_integration_test.go @@ -73,8 +73,7 @@ func (suite *BackupExchangeIntegrationSuite) SetupSuite() { // restoration requires an existing backup sel := selectors.NewExchangeBackup() - // TODO: only backup the inbox - sel.Include(sel.Users([]string{suite.m365UserID})) + sel.Include(sel.MailFolders([]string{suite.m365UserID}, []string{"Inbox"})) suite.backupOp, err = suite.repo.NewBackup( ctx, sel.Selector, diff --git a/src/internal/connector/exchange/service_functions.go b/src/internal/connector/exchange/service_functions.go index a431942b2..bfa83aa00 100644 --- a/src/internal/connector/exchange/service_functions.go +++ b/src/internal/connector/exchange/service_functions.go @@ -140,7 +140,11 @@ func GetMailFolderID(service graph.Service, folderName, user string) (*string, e response, err := GetAllFolderNamesForUser(service, user) if err != nil { - return nil, err + return nil, errors.Wrapf( + err, + "user %s M365 query: %s", + user, support.ConnectorStackErrorTrace(err), + ) } pageIterator, err := msgraphgocore.NewPageIterator( diff --git a/src/internal/connector/graph_connector.go b/src/internal/connector/graph_connector.go index 61329b0e9..1c57703df 100644 --- a/src/internal/connector/graph_connector.go +++ b/src/internal/connector/graph_connector.go @@ -21,7 +21,6 @@ import ( "github.com/alcionai/corso/internal/data" "github.com/alcionai/corso/pkg/account" "github.com/alcionai/corso/pkg/control" - "github.com/alcionai/corso/pkg/logger" "github.com/alcionai/corso/pkg/selectors" ) @@ -299,7 +298,6 @@ func (gc *GraphConnector) RestoreMessages(ctx context.Context, dcs []data.Collec go func(cos *support.ConnectorOperationStatus) { gc.statusCh <- cos }(status) - logger.Ctx(ctx).Debug(gc.PrintableStatus()) return errs } diff --git a/src/internal/operations/restore.go b/src/internal/operations/restore.go index 284e91468..dbfcc0581 100644 --- a/src/internal/operations/restore.go +++ b/src/internal/operations/restore.go @@ -16,6 +16,7 @@ import ( "github.com/alcionai/corso/internal/stats" "github.com/alcionai/corso/pkg/account" "github.com/alcionai/corso/pkg/control" + "github.com/alcionai/corso/pkg/logger" "github.com/alcionai/corso/pkg/selectors" "github.com/alcionai/corso/pkg/store" ) @@ -142,6 +143,7 @@ func (op *RestoreOperation) Run(ctx context.Context) (err error) { } opStats.started = true opStats.gc = gc.AwaitStatus() + logger.Ctx(ctx).Debug(gc.PrintableStatus()) return nil }