Documentation ¶
Overview ¶
Package testdirtree provides utilities for creating test directory trees for testing.
Index ¶
- func CreateDirectoryTree(dirname string, options DirectoryTreeOptions, counters *DirectoryTreeCounters) error
- func CreateRandomFile(filePath string, options DirectoryTreeOptions, counters *DirectoryTreeCounters) error
- func MustCreateDirectoryTree(t *testing.T, dirname string, options DirectoryTreeOptions)
- func MustCreateRandomFile(t *testing.T, filePath string, options DirectoryTreeOptions, ...)
- type DirectoryTreeCounters
- type DirectoryTreeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDirectoryTree ¶
func CreateDirectoryTree(dirname string, options DirectoryTreeOptions, counters *DirectoryTreeCounters) error
CreateDirectoryTree creates a directory tree of a given depth with random files.
func CreateRandomFile ¶
func CreateRandomFile(filePath string, options DirectoryTreeOptions, counters *DirectoryTreeCounters) error
CreateRandomFile creates a new file at the provided path with randomized contents.
func MustCreateDirectoryTree ¶
func MustCreateDirectoryTree(t *testing.T, dirname string, options DirectoryTreeOptions)
MustCreateDirectoryTree creates a directory tree of a given depth with random files.
func MustCreateRandomFile ¶
func MustCreateRandomFile(t *testing.T, filePath string, options DirectoryTreeOptions, counters *DirectoryTreeCounters)
MustCreateRandomFile creates a new file at the provided path with randomized contents. It will fail with a test error if the creation does not succeed.
Types ¶
type DirectoryTreeCounters ¶
type DirectoryTreeCounters struct { Files int Directories int Symlinks int TotalFileSize int64 MaxFileSize int64 }
DirectoryTreeCounters stores stats about files and directories created by CreateDirectoryTree.
type DirectoryTreeOptions ¶
type DirectoryTreeOptions struct { Depth int MaxSubdirsPerDirectory int MaxFilesPerDirectory int MaxSymlinksPerDirectory int MaxFileSize int MinFileSize int MinNameLength int MaxNameLength int NonExistingSymlinkTargetPercentage int // 0..100 }
DirectoryTreeOptions lists options for CreateDirectoryTree.
func MaybeSimplifyFilesystem ¶
func MaybeSimplifyFilesystem(o DirectoryTreeOptions) DirectoryTreeOptions
MaybeSimplifyFilesystem applies caps to the provided DirectoryTreeOptions to reduce test time on ARM.