Documentation
¶
Overview ¶
Package mocks provides some common utilities to test the fuse functionality
Index ¶
- func AssertTree(t testing.TB, tree UploadTree, root string)
- func EmptyBundle(ev mocks.TestEnv) *core.Bundle
- func FakeBundle(ev mocks.TestEnv) *core.Bundle
- func NewErrPutCaFs(t testing.TB, blob storage.Store, leafSize uint32) (cafs.Fs, error)
- func TestInspectDir(t testing.TB, pth string)
- type UploadFileTest
- type UploadTree
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertTree ¶
func AssertTree(t testing.TB, tree UploadTree, root string)
AssertTree checks an actual FS structure against some reference in-memory fixture folder description
func EmptyBundle ¶
EmptyBundle produces an initialized bundle with proper staging and context, but no bundle ID yet
func FakeBundle ¶
FakeBundle produce some fake bundle structure for this test environment
func NewErrPutCaFs ¶
NewErrPutCaFs produces a mocked up cafs.Fs used to simulate a Put error
func TestInspectDir ¶
TestInspectDir is a debug helper to inspect the various temp mounts before removal
Types ¶
type UploadFileTest ¶
type UploadFileTest struct {
// contains filtered or unexported fields
}
UploadFileTest describes a mocked up uploaded file fixture
type UploadTree ¶
type UploadTree []*UploadFileTest
UploadTree define a mocked up file hierarchy
func MakeTestUploadTree ¶
func MakeTestUploadTree() UploadTree
MakeTestUploadTree defines a default fixture to test a hierarchy of files, with different sizes
func PopulateFS ¶
func PopulateFS(t testing.TB, mountPath string, fixtureBuilders ...func() UploadTree) UploadTree
PopulateFS populates the file tree fixture, with some random data in mocked up files. It prepares the expected locations relative to mountPath.
* write files to the mounted filesystem, with random data. * the returned structure keeps data and checksums to make further assertions
func PopulateFSWithDirs ¶
func PopulateFSWithDirs(t testing.TB, mountPath string, withFile bool, fixtureBuilders ...func() UploadTree) UploadTree
PopulateFSWithDirs is the same as TestPopulateFS, but ignores size and just create directories instead of files.
Notes ¶
Bugs ¶
spotted in rw mount. If we put all files with same content, the deduplication ends up with an error on commit... => have to randomize for now data := []byte(`not empty`)