Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

fstest: stop errors in test cleanup changing the global stats

Nick Craig-Wood04683f2032e2
diff --git a/fstest/fstest.go b/fstest/fstest.go
index 794362b64..e2a594011 100644
--- a/fstest/fstest.go
+++ b/fstest/fstest.go
@@ -482,7 +482,9 @@ func RandomRemote() (fs.Fs, string, func(), error) {
//
// It logs errors rather than returning them
func Purge(f fs.Fs) {
- ctx := context.Background()
+ // Create a stats group here so errors in the cleanup don't
+ // interfere with the global stats.
+ ctx := accounting.WithStatsGroup(context.Background(), "test-cleanup")
var err error
doFallbackPurge := true
if doPurge := f.Features().Purge; doPurge != nil {