helpers

package
v2.19.7 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OwnerID                = "25b69780-5f39-43be-a7ac-a9b9e9fe4230"
	DeleteAllSpacesUserID  = "39885dbc-68c0-47c0-a873-9d5e5646dceb"
	DeleteHomeSpacesUserID = "ca8c6bf1-36a7-4d10-87a5-a2806566f983"
	User0ID                = "824385ae-8fc6-4896-8eb2-d1d171290bd0"
	User1ID                = "693b0d96-80a2-4016-b53d-425ce4f66114"
)

Constant UUIDs for the space users

Variables

This section is empty.

Functions

This section is empty.

Types

type TestEnv

type TestEnv struct {
	Root                 string
	Fs                   *decomposedfs.Decomposedfs
	Tree                 *tree.Tree
	Permissions          *mocks.PermissionsChecker
	Blobstore            *treemocks.Blobstore
	Owner                *userpb.User
	DeleteAllSpacesUser  *userpb.User
	DeleteHomeSpacesUser *userpb.User
	Users                []*userpb.User
	Lookup               *lookup.Lookup
	Ctx                  context.Context
	SpaceRootRes         *providerv1beta1.ResourceId
	PermissionsClient    *mocks.CS3PermissionsClient
	Options              *options.Options
}

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