From 1dd27a45aaacbd14b53234277aa874029fc674bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Tue, 4 Jul 2023 09:07:50 +0200 Subject: [PATCH] Fix unit tests --- .../utils/decomposedfs/testhelpers/helpers.go | 15 ++++++++------- pkg/storage/utils/decomposedfs/tree/tree.go | 2 +- .../utils/decomposedfs/upload_async_test.go | 3 ++- pkg/storage/utils/decomposedfs/upload_test.go | 3 ++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/pkg/storage/utils/decomposedfs/testhelpers/helpers.go b/pkg/storage/utils/decomposedfs/testhelpers/helpers.go index 78ceaaa4930..394f0289d26 100644 --- a/pkg/storage/utils/decomposedfs/testhelpers/helpers.go +++ b/pkg/storage/utils/decomposedfs/testhelpers/helpers.go @@ -24,12 +24,6 @@ import ( "os" "path/filepath" - "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" - "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/lookup" - "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata" - "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata/prefixes" - "github.com/cs3org/reva/v2/pkg/storagespace" - "github.com/cs3org/reva/v2/pkg/store" "github.com/google/uuid" "github.com/stretchr/testify/mock" "google.golang.org/grpc" @@ -39,12 +33,19 @@ import ( v1beta11 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" ruser "github.com/cs3org/reva/v2/pkg/ctx" + "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" + "github.com/cs3org/reva/v2/pkg/storage/cache" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs" + "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/lookup" + "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata" + "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata/prefixes" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/mocks" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/options" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/tree" treemocks "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/tree/mocks" + "github.com/cs3org/reva/v2/pkg/storagespace" + "github.com/cs3org/reva/v2/pkg/store" "github.com/cs3org/reva/v2/tests/helpers" ) @@ -151,7 +152,7 @@ func NewTestEnv(config map[string]interface{}) (*TestEnv, error) { case "xattrs": lu = lookup.New(metadata.XattrsBackend{}, o) case "messagepack": - lu = lookup.New(metadata.NewMessagePackBackend(o.Root, o.FileMetadataCache), o) + lu = lookup.New(metadata.NewMessagePackBackend(o.Root, cache.Config{Store: "noop"}), o) default: return nil, fmt.Errorf("unknown metadata backend %s", o.MetadataBackend) } diff --git a/pkg/storage/utils/decomposedfs/tree/tree.go b/pkg/storage/utils/decomposedfs/tree/tree.go index 0b875a17749..ced3330f92a 100644 --- a/pkg/storage/utils/decomposedfs/tree/tree.go +++ b/pkg/storage/utils/decomposedfs/tree/tree.go @@ -767,7 +767,7 @@ func (t *Tree) Propagate(ctx context.Context, n *node.Node, sizeDiff int64) (err } }() - if n, err = n.ParentWithReader(ctx, f); err != nil { + if n, err = n.Parent(ctx); err != nil { sublog.Error().Err(err). Msg("Propagation failed. Could not read parent node.") return err diff --git a/pkg/storage/utils/decomposedfs/upload_async_test.go b/pkg/storage/utils/decomposedfs/upload_async_test.go index 123376ed691..1bf309a9796 100644 --- a/pkg/storage/utils/decomposedfs/upload_async_test.go +++ b/pkg/storage/utils/decomposedfs/upload_async_test.go @@ -16,6 +16,7 @@ import ( "github.com/cs3org/reva/v2/pkg/events/stream" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/cs3org/reva/v2/pkg/storage" + "github.com/cs3org/reva/v2/pkg/storage/cache" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/lookup" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/mocks" @@ -87,7 +88,7 @@ var _ = Describe("Async file uploads", Ordered, func() { }) Expect(err).ToNot(HaveOccurred()) - lu = lookup.New(metadata.XattrsBackend{}, o) + lu = lookup.New(metadata.NewMessagePackBackend(o.Root, cache.Config{Store: "noop"}), o) permissions = &mocks.PermissionsChecker{} cs3permissionsclient = &mocks.CS3PermissionsClient{} diff --git a/pkg/storage/utils/decomposedfs/upload_test.go b/pkg/storage/utils/decomposedfs/upload_test.go index cae55234c04..4b6005a8f30 100644 --- a/pkg/storage/utils/decomposedfs/upload_test.go +++ b/pkg/storage/utils/decomposedfs/upload_test.go @@ -32,6 +32,7 @@ import ( "github.com/cs3org/reva/v2/pkg/errtypes" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/cs3org/reva/v2/pkg/storage" + "github.com/cs3org/reva/v2/pkg/storage/cache" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/lookup" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata" @@ -101,7 +102,7 @@ var _ = Describe("File uploads", func() { "root": tmpRoot, }) Expect(err).ToNot(HaveOccurred()) - lu = lookup.New(metadata.XattrsBackend{}, o) + lu = lookup.New(metadata.NewMessagePackBackend(o.Root, cache.Config{Store: "noop"}), o) permissions = &mocks.PermissionsChecker{} cs3permissionsclient = &mocks.CS3PermissionsClient{} pool.RemoveSelector("PermissionsSelector" + "any")