helpers

package
v2.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestEnv

type TestEnv struct {
	Root              string
	Fs                storage.FS
	Tree              *tree.Tree
	Permissions       *mocks.PermissionsChecker
	Blobstore         *treemocks.Blobstore
	Owner             *userpb.User
	Lookup            *lookup.Lookup
	Ctx               context.Context
	SpaceRootRes      *providerv1beta1.ResourceId
	PermissionsClient *mocks.CS3PermissionsClient
}

TestEnv represents a test environment for unit tests

func NewTestEnv

func NewTestEnv(config map[string]interface{}) (*TestEnv, error)

NewTestEnv prepares a test environment on disk The storage contains some directories and a file:

/dir1/
/dir1/file1
/dir1/subdir1/

The default config can be overridden by providing the strings to override via map as a parameter

func (*TestEnv) Cleanup

func (t *TestEnv) Cleanup()

Cleanup removes all files from disk

func (*TestEnv) CreateTestDir

func (t *TestEnv) CreateTestDir(name string, parentRef *providerv1beta1.Reference) (*node.Node, error)

CreateTestDir create a directory and returns a corresponding Node

func (*TestEnv) CreateTestFile

func (t *TestEnv) CreateTestFile(name, blobID, parentID, spaceID string, blobSize int64) (*node.Node, error)

CreateTestFile creates a new file and its metadata and returns a corresponding Node

func (*TestEnv) CreateTestStorageSpace

func (t *TestEnv) CreateTestStorageSpace(typ string, quota *providerv1beta1.Quota) (*providerv1beta1.ResourceId, error)

CreateTestStorageSpace will create a storage space with some directories and files It returns the ResourceId of the space

/dir1/ /dir1/file1 /dir1/subdir1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL