Skip to content

Commit

Permalink
try fixing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Jun 8, 2021
1 parent 05e752d commit 61d19c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ var _ = Describe("Decomposed", func() {
It("handle already existing directories", func() {
for i := 0; i < 10; i++ {
go func() {
err := fs.CreateDir(ctx, "fightforit")
err := fs.CreateDir(ctx, &provider.Reference{Path: "."}, "fightforit")
if err != nil {
rinfo, err := fs.GetMD(ctx, &provider.Reference{Path: "fightforit"}, nil)
Expect(err).ToNot(HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/utils/decomposedfs/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (lu *Lookup) NodeFromResource(ctx context.Context, ref *provider.Reference)
}

if ref.Path != "" {
return lu.NodeFromPath(ctx, ref.GetPath())
return lu.NodeFromPath(ctx, ref.Path)
}

// reference is invalid
Expand Down
8 changes: 5 additions & 3 deletions pkg/storage/utils/decomposedfs/testhelpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ package helpers
import (
"context"
"os"
"path"
"path/filepath"

"github.com/google/uuid"
"github.com/stretchr/testify/mock"

userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/cs3org/reva/pkg/storage"
"github.com/cs3org/reva/pkg/storage/utils/decomposedfs"
"github.com/cs3org/reva/pkg/storage/utils/decomposedfs/mocks"
Expand Down Expand Up @@ -123,13 +125,13 @@ func NewTestEnv() (*TestEnv, error) {
}

// Create subdir1 in dir1
err = fs.CreateDir(ctx, "dir1/subdir1")
err = fs.CreateDir(ctx, &providerv1beta1.Reference{Path: "dir1"}, "subdir1")
if err != nil {
return nil, err
}

// Create emptydir
err = fs.CreateDir(ctx, "emptydir")
err = fs.CreateDir(ctx, &providerv1beta1.Reference{Path: "."}, "emptydir")
if err != nil {
return nil, err
}
Expand All @@ -144,7 +146,7 @@ func (t *TestEnv) Cleanup() {

// CreateTestDir create a directory and returns a corresponding Node
func (t *TestEnv) CreateTestDir(name string) (*node.Node, error) {
err := t.Fs.CreateDir(t.Ctx, name)
err := t.Fs.CreateDir(t.Ctx, &providerv1beta1.Reference{Path: path.Dir(name)}, path.Base(name))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 61d19c1

Please sign in to comment.