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

test memory: read metadata if -M flag is specified

Nick Craig-Wood43506f80863a
diff --git a/cmd/test/memory/memory.go b/cmd/test/memory/memory.go
index 432110881..058a5e8a5 100644
--- a/cmd/test/memory/memory.go
+++ b/cmd/test/memory/memory.go
@@ -29,6 +29,7 @@ var commandDefinition = &cobra.Command{
cmd.Run(false, false, command, func() error {
ctx := context.Background()
ci := fs.GetConfig(context.Background())
+ metadata := ci.Metadata && fsrc.Features().ReadMetadata
objects, _, _, err := operations.Count(ctx, fsrc)
if err != nil {
return err
@@ -39,6 +40,13 @@ var commandDefinition = &cobra.Command{
runtime.ReadMemStats(&before)
var mu sync.Mutex
err = operations.ListFn(ctx, fsrc, func(o fs.Object) {
+ // Read the metadata so it gets cached in the object
+ if metadata {
+ _, err := fs.GetMetadata(ctx, o)
+ if err != nil {
+ fs.Errorf(o, "Failed to read metadata: %v", err)
+ }
+ }
mu.Lock()
objs = append(objs, o)
mu.Unlock()