Documentation ¶
Overview ¶
Package fstests provides generic integration tests for the Fs and Object interfaces.
These tests are concerned with the basic functionality of a backend. The tests in fs/sync and fs/operations tests more cornercases that these tests don't.
Index ¶
- Variables
- func NextMultipleOf(m fs.SizeSuffix) func(fs.SizeSuffix) fs.SizeSuffix
- func NextPowerOfTwo(i fs.SizeSuffix) fs.SizeSuffix
- func PutTestContents(ctx context.Context, t *testing.T, f fs.Fs, file *fstest.Item, contents string, ...) fs.Object
- func PutTestContentsMetadata(ctx context.Context, t *testing.T, f fs.Fs, file *fstest.Item, ...) fs.Object
- func ReadObject(ctx context.Context, t *testing.T, obj fs.Object, limit int64, ...) string
- func Run(t *testing.T, opt *Opt)
- func TestPutLarge(ctx context.Context, t *testing.T, f fs.Fs, file *fstest.Item)
- func TestPutLargeStreamed(ctx context.Context, t *testing.T, f fs.Fs, file *fstest.Item)
- type ChunkedUploadConfig
- type ExtraConfigItem
- type InternalTester
- type Opt
- type SetCopyCutoffer
- type SetUploadChunkSizer
- type SetUploadCutoffer
Constants ¶
This section is empty.
Variables ¶
var InternalTestFiles []fstest.Item
InternalTestFiles is the state of the remote at the moment the internal tests are called
Functions ¶
func NextMultipleOf ¶
func NextMultipleOf(m fs.SizeSuffix) func(fs.SizeSuffix) fs.SizeSuffix
NextMultipleOf returns a function that can be used as a CeilChunkSize function. This function will return the next multiple of m that is equal or bigger than i. All values less or equal 0 will return 0.
func NextPowerOfTwo ¶
func NextPowerOfTwo(i fs.SizeSuffix) fs.SizeSuffix
NextPowerOfTwo returns the current or next bigger power of two. All values less or equal 0 will return 0
func PutTestContents ¶ added in v1.50.0
func PutTestContents(ctx context.Context, t *testing.T, f fs.Fs, file *fstest.Item, contents string, check bool) fs.Object
PutTestContents puts file with given contents to the remote and checks it but unlike TestPutLarge doesn't remove
func PutTestContentsMetadata ¶ added in v1.59.0
func PutTestContentsMetadata(ctx context.Context, t *testing.T, f fs.Fs, file *fstest.Item, useFileHashes bool, contents string, check bool, mimeType string, metadata fs.Metadata, options ...fs.OpenOption) fs.Object
PutTestContentsMetadata puts file with given contents to the remote and checks it but unlike TestPutLarge doesn't remove
It uploads the object with the mimeType and metadata passed in if set.
It returns the object which will have been checked if check is set
func ReadObject ¶ added in v1.60.0
func ReadObject(ctx context.Context, t *testing.T, obj fs.Object, limit int64, options ...fs.OpenOption) string
ReadObject reads the contents of an object as a string
func Run ¶
Run runs the basic integration tests for a remote using the options passed in.
They are structured in a hierarchical way so that dependencies for the tests can be created.
For example some tests require the directory to be created - these are inside the "FsMkdir" test. Some tests require some tests files - these are inside the "FsPutFiles" test.
func TestPutLarge ¶ added in v1.50.0
TestPutLarge puts file to the remote, checks it and removes it on success.
Types ¶
type ChunkedUploadConfig ¶
type ChunkedUploadConfig struct { // Minimum allowed chunk size MinChunkSize fs.SizeSuffix // Maximum allowed chunk size, 0 is no limit MaxChunkSize fs.SizeSuffix // Rounds the given chunk size up to the next valid value // nil will disable rounding // e.g. the next power of 2 CeilChunkSize func(fs.SizeSuffix) fs.SizeSuffix // More than one chunk is required on upload NeedMultipleChunks bool // Skip this particular remote Skip bool }
ChunkedUploadConfig contains the values used by TestFsPutChunked to determine the limits of chunked uploading
type ExtraConfigItem ¶
type ExtraConfigItem struct{ Name, Key, Value string }
ExtraConfigItem describes a config item for the tests
type InternalTester ¶
InternalTester is an optional interface for Fs which allows to execute internal tests
This interface should be implemented in 'backend'_internal_test.go and not in 'backend'.go
type Opt ¶
type Opt struct { RemoteName string NilObject fs.Object ExtraConfig []ExtraConfigItem SkipBadWindowsCharacters bool // skips unusable characters for windows if set SkipFsMatch bool // if set skip exact matching of Fs value TiersToTest []string // List of tiers which can be tested in setTier test ChunkedUpload ChunkedUploadConfig UnimplementableFsMethods []string // List of Fs methods which can't be implemented in this wrapping Fs UnimplementableObjectMethods []string // List of Object methods which can't be implemented in this wrapping Fs UnimplementableDirectoryMethods []string // List of Directory methods which can't be implemented in this wrapping Fs SkipFsCheckWrap bool // if set skip FsCheckWrap SkipObjectCheckWrap bool // if set skip ObjectCheckWrap SkipDirectoryCheckWrap bool // if set skip DirectoryCheckWrap SkipInvalidUTF8 bool // if set skip invalid UTF-8 checks SkipLeadingDot bool // if set skip leading dot checks QuickTestOK bool // if set, run this test with make quicktest }
Opt is options for Run
type SetCopyCutoffer ¶ added in v1.65.0
type SetCopyCutoffer interface { // Change the configured CopyCutoff. // Will only be called while no transfer is in progress. // Return fs.ErrorNotImplemented if you can't implement this SetCopyCutoff(fs.SizeSuffix) (fs.SizeSuffix, error) }
SetCopyCutoffer is a test only interface to change the copy cutoff size at runtime
type SetUploadChunkSizer ¶
type SetUploadChunkSizer interface { // Change the configured UploadChunkSize. // Will only be called while no transfer is in progress. SetUploadChunkSize(fs.SizeSuffix) (fs.SizeSuffix, error) }
SetUploadChunkSizer is a test only interface to change the upload chunk size at runtime
type SetUploadCutoffer ¶
type SetUploadCutoffer interface { // Change the configured UploadCutoff. // Will only be called while no transfer is in progress. SetUploadCutoff(fs.SizeSuffix) (fs.SizeSuffix, error) }
SetUploadCutoffer is a test only interface to change the upload cutoff size at runtime