log failure cause on purge (#1307)

## Description

Load tests fail on the post-test cleanup using the purge script,
but are not currently logging the cause.  Local repro has not
been successful.  This change adds additional error logging
output for review in case of failure.

## Type of change

- [x] 🤖 Test

## Issue(s)

* #902

## Test Plan

- [x] 💪 Manual
This commit is contained in:
Keepers 2022-10-24 15:54:48 -06:00 committed by GitHub
parent be3c0d40f8
commit 1aa2d987e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,6 +131,7 @@ func handleMailFolderPurge(cmd *cobra.Command, args []string) error {
}
if err := runPurgeForEachUser(ctx, gc, t, purgeMailFolders); err != nil {
logger.Ctx(ctx).Error(err)
return Only(ctx, errors.Wrap(ErrPurging, "mail folders"))
}
@ -150,6 +151,7 @@ func handleCalendarFolderPurge(cmd *cobra.Command, args []string) error {
}
if err := runPurgeForEachUser(ctx, gc, t, purgeCalendarFolders); err != nil {
logger.Ctx(ctx).Error(err)
return Only(ctx, errors.Wrap(ErrPurging, "event calendars"))
}
@ -169,6 +171,7 @@ func handleContactsFolderPurge(cmd *cobra.Command, args []string) error {
}
if err := runPurgeForEachUser(ctx, gc, t, purgeContactFolders); err != nil {
logger.Ctx(ctx).Error(err)
return Only(ctx, errors.Wrap(ErrPurging, "contact folders"))
}
@ -188,6 +191,7 @@ func handleOneDriveFolderPurge(cmd *cobra.Command, args []string) error {
}
if err := runPurgeForEachUser(ctx, gc, t, purgeOneDriveFolders); err != nil {
logger.Ctx(ctx).Error(err)
return Only(ctx, errors.Wrap(ErrPurging, "OneDrive folders"))
}
@ -384,7 +388,7 @@ func purgeFolders(
getter func(graph.Service, string, string) ([]purgable, error),
deleter func(graph.Service, string, purgable) error,
) error {
Infof(ctx, "\nContainer: %s", data)
Infof(ctx, "Container: %s", data)
// get them folders
fs, err := getter(gc.Service(), uid, prefix)
@ -417,7 +421,7 @@ func purgeFolders(
continue
}
Infof(ctx, "Deleting [%s]", displayName)
Infof(ctx, "Deleting [%s]", displayName)
err = deleter(gc.Service(), uid, fld)
if err != nil {