fstests

package
v1.48.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 25 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextMultipleOf added in v1.46.0

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 added in v1.46.0

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 Run

func Run(t *testing.T, opt *Opt)

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.

Types

type ChunkedUploadConfig added in v1.46.0

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
}

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

type InternalTester interface {
	InternalTest(*testing.T)
}

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 methods which can't be implemented in this wrapping Fs
	UnimplementableObjectMethods []string // List of methods which can't be implemented in this wrapping Fs
	SkipFsCheckWrap              bool     // if set skip FsCheckWrap
	SkipObjectCheckWrap          bool     // if set skip ObjectCheckWrap
}

Opt is options for Run

type SetUploadChunkSizer added in v1.46.0

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 added in v1.46.0

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

Jump to

Keyboard shortcuts

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