testsuites

package
v3.0.0-...-11ed768 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterSuite

func RegisterSuite(driverConstructor DriverConstructor, skipCheck SkipCheck)

RegisterSuite registers an in-process storage driver test suite with the go test runner.

func Test

func Test(t *testing.T)

Test hooks up gocheck into the "go test" runner.

Types

type DriverConstructor

type DriverConstructor func() (storagedriver.StorageDriver, error)

DriverConstructor is a function which returns a new storagedriver.StorageDriver.

type DriverSuite

type DriverSuite struct {
	Constructor DriverConstructor
	Teardown    DriverTeardown
	SkipCheck
	storagedriver.StorageDriver
	// contains filtered or unexported fields
}

DriverSuite is a gocheck test suite designed to test a storagedriver.StorageDriver. The intended way to create a DriverSuite is with RegisterSuite.

func (*DriverSuite) BenchmarkDelete50Files

func (suite *DriverSuite) BenchmarkDelete50Files(c *check.C)

BenchmarkDelete50Files benchmarks Delete for 50 small files

func (*DriverSuite) BenchmarkDelete5Files

func (suite *DriverSuite) BenchmarkDelete5Files(c *check.C)

BenchmarkDelete5Files benchmarks Delete for 5 small files

func (*DriverSuite) BenchmarkList50Files

func (suite *DriverSuite) BenchmarkList50Files(c *check.C)

BenchmarkList50Files benchmarks List for 50 small files

func (*DriverSuite) BenchmarkList5Files

func (suite *DriverSuite) BenchmarkList5Files(c *check.C)

BenchmarkList5Files benchmarks List for 5 small files

func (*DriverSuite) BenchmarkPutGet1GBFiles

func (suite *DriverSuite) BenchmarkPutGet1GBFiles(c *check.C)

BenchmarkPutGet1GBFiles benchmarks PutContent/GetContent for 1GB files

func (*DriverSuite) BenchmarkPutGet1KBFiles

func (suite *DriverSuite) BenchmarkPutGet1KBFiles(c *check.C)

BenchmarkPutGet1KBFiles benchmarks PutContent/GetContent for 1KB files

func (*DriverSuite) BenchmarkPutGet1MBFiles

func (suite *DriverSuite) BenchmarkPutGet1MBFiles(c *check.C)

BenchmarkPutGet1MBFiles benchmarks PutContent/GetContent for 1MB files

func (*DriverSuite) BenchmarkPutGetEmptyFiles

func (suite *DriverSuite) BenchmarkPutGetEmptyFiles(c *check.C)

BenchmarkPutGetEmptyFiles benchmarks PutContent/GetContent for 0B files

func (*DriverSuite) BenchmarkStream1GBFiles

func (suite *DriverSuite) BenchmarkStream1GBFiles(c *check.C)

BenchmarkStream1GBFiles benchmarks Writer/Reader for 1GB files

func (*DriverSuite) BenchmarkStream1KBFiles

func (suite *DriverSuite) BenchmarkStream1KBFiles(c *check.C)

BenchmarkStream1KBFiles benchmarks Writer/Reader for 1KB files

func (*DriverSuite) BenchmarkStream1MBFiles

func (suite *DriverSuite) BenchmarkStream1MBFiles(c *check.C)

BenchmarkStream1MBFiles benchmarks Writer/Reader for 1MB files

func (*DriverSuite) BenchmarkStreamEmptyFiles

func (suite *DriverSuite) BenchmarkStreamEmptyFiles(c *check.C)

BenchmarkStreamEmptyFiles benchmarks Writer/Reader for 0B files

func (*DriverSuite) SetUpSuite

func (suite *DriverSuite) SetUpSuite(c *check.C)

SetUpSuite sets up the gocheck test suite.

func (*DriverSuite) TearDownSuite

func (suite *DriverSuite) TearDownSuite(c *check.C)

TearDownSuite tears down the gocheck test suite.

func (*DriverSuite) TearDownTest

func (suite *DriverSuite) TearDownTest(c *check.C)

TearDownTest tears down the gocheck test. This causes the suite to abort if any files are left around in the storage driver.

func (*DriverSuite) TestConcurrentFileStreams

func (suite *DriverSuite) TestConcurrentFileStreams(c *check.C)

TestConcurrentFileStreams checks that multiple *os.File objects can be passed in to Writer concurrently without hanging.

func (*DriverSuite) TestConcurrentStreamReads

func (suite *DriverSuite) TestConcurrentStreamReads(c *check.C)

TestConcurrentStreamReads checks that multiple clients can safely read from the same file simultaneously with various offsets.

func (*DriverSuite) TestContinueStreamAppendLarge

func (suite *DriverSuite) TestContinueStreamAppendLarge(c *check.C)

TestContinueStreamAppendLarge tests that a stream write can be appended to without corrupting the data with a large chunk size.

func (*DriverSuite) TestContinueStreamAppendSmall

func (suite *DriverSuite) TestContinueStreamAppendSmall(c *check.C)

TestContinueStreamAppendSmall is the same as TestContinueStreamAppendLarge, but only with a tiny chunk size in order to test corner cases for some cloud storage drivers.

func (*DriverSuite) TestDelete

func (suite *DriverSuite) TestDelete(c *check.C)

TestDelete checks that the delete operation removes data from the storage driver

func (*DriverSuite) TestDeleteFolder

func (suite *DriverSuite) TestDeleteFolder(c *check.C)

TestDeleteFolder checks that deleting a folder removes all child elements.

func (*DriverSuite) TestDeleteNonexistent

func (suite *DriverSuite) TestDeleteNonexistent(c *check.C)

TestDeleteNonexistent checks that removing a nonexistent key fails.

func (*DriverSuite) TestDeleteOnlyDeletesSubpaths

func (suite *DriverSuite) TestDeleteOnlyDeletesSubpaths(c *check.C)

TestDeleteOnlyDeletesSubpaths checks that deleting path A does not delete path B when A is a prefix of B but B is not a subpath of A (so that deleting "/a" does not delete "/ab"). This matters for services like S3 that do not implement directories.

func (*DriverSuite) TestInvalidPaths

func (suite *DriverSuite) TestInvalidPaths(c *check.C)

TestInvalidPaths checks that various invalid file paths are rejected by the storage driver.

func (*DriverSuite) TestList

func (suite *DriverSuite) TestList(c *check.C)

TestList checks the returned list of keys after populating a directory tree.

func (*DriverSuite) TestMove

func (suite *DriverSuite) TestMove(c *check.C)

TestMove checks that a moved object no longer exists at the source path and does exist at the destination.

func (*DriverSuite) TestMoveInvalid

func (suite *DriverSuite) TestMoveInvalid(c *check.C)

TestMoveInvalid provides various checks for invalid moves.

func (*DriverSuite) TestMoveNonexistent

func (suite *DriverSuite) TestMoveNonexistent(c *check.C)

TestMoveNonexistent checks that moving a nonexistent key fails and does not delete the data at the destination path.

func (*DriverSuite) TestMoveOverwrite

func (suite *DriverSuite) TestMoveOverwrite(c *check.C)

TestMoveOverwrite checks that a moved object no longer exists at the source path and overwrites the contents at the destination.

func (*DriverSuite) TestPutContentMultipleTimes

func (suite *DriverSuite) TestPutContentMultipleTimes(c *check.C)

TestPutContentMultipleTimes checks that if storage driver can overwrite the content in the subsequent puts. Validates that PutContent does not have to work with an offset like Writer does and overwrites the file entirely rather than writing the data to the [0,len(data)) of the file.

func (*DriverSuite) TestReadNonexistent

func (suite *DriverSuite) TestReadNonexistent(c *check.C)

TestReadNonexistent tests reading content from an empty path.

func (*DriverSuite) TestReadNonexistentStream

func (suite *DriverSuite) TestReadNonexistentStream(c *check.C)

TestReadNonexistentStream tests that reading a stream for a nonexistent path fails.

func (*DriverSuite) TestReaderWithOffset

func (suite *DriverSuite) TestReaderWithOffset(c *check.C)

TestReaderWithOffset tests that the appropriate data is streamed when reading with a given offset.

func (*DriverSuite) TestRootExists

func (suite *DriverSuite) TestRootExists(c *check.C)

TestRootExists ensures that all storage drivers have a root path by default.

func (*DriverSuite) TestStatCall

func (suite *DriverSuite) TestStatCall(c *check.C)

TestStatCall runs verifies the implementation of the storagedriver's Stat call.

func (*DriverSuite) TestTruncate

func (suite *DriverSuite) TestTruncate(c *check.C)

TestTruncate tests that putting smaller contents than an original file does remove the excess contents.

func (*DriverSuite) TestURLFor

func (suite *DriverSuite) TestURLFor(c *check.C)

TestURLFor checks that the URLFor method functions properly, but only if it is implemented

func (*DriverSuite) TestValidPaths

func (suite *DriverSuite) TestValidPaths(c *check.C)

TestValidPaths checks that various valid file paths are accepted by the storage driver.

func (*DriverSuite) TestWriteRead1

func (suite *DriverSuite) TestWriteRead1(c *check.C)

TestWriteRead1 tests a simple write-read workflow.

func (*DriverSuite) TestWriteRead2

func (suite *DriverSuite) TestWriteRead2(c *check.C)

TestWriteRead2 tests a simple write-read workflow with unicode data.

func (*DriverSuite) TestWriteRead3

func (suite *DriverSuite) TestWriteRead3(c *check.C)

TestWriteRead3 tests a simple write-read workflow with a small string.

func (*DriverSuite) TestWriteRead4

func (suite *DriverSuite) TestWriteRead4(c *check.C)

TestWriteRead4 tests a simple write-read workflow with 1MB of data.

func (*DriverSuite) TestWriteReadLargeStreams

func (suite *DriverSuite) TestWriteReadLargeStreams(c *check.C)

TestWriteReadLargeStreams tests that a 5GB file may be written to the storage driver safely.

func (*DriverSuite) TestWriteReadNonUTF8

func (suite *DriverSuite) TestWriteReadNonUTF8(c *check.C)

TestWriteReadNonUTF8 tests that non-utf8 data may be written to the storage driver safely.

func (*DriverSuite) TestWriteReadStreams1

func (suite *DriverSuite) TestWriteReadStreams1(c *check.C)

TestWriteReadStreams1 tests a simple write-read streaming workflow.

func (*DriverSuite) TestWriteReadStreams2

func (suite *DriverSuite) TestWriteReadStreams2(c *check.C)

TestWriteReadStreams2 tests a simple write-read streaming workflow with unicode data.

func (*DriverSuite) TestWriteReadStreams3

func (suite *DriverSuite) TestWriteReadStreams3(c *check.C)

TestWriteReadStreams3 tests a simple write-read streaming workflow with a small amount of data.

func (*DriverSuite) TestWriteReadStreams4

func (suite *DriverSuite) TestWriteReadStreams4(c *check.C)

TestWriteReadStreams4 tests a simple write-read streaming workflow with 1MB of data.

func (*DriverSuite) TestWriteReadStreamsNonUTF8

func (suite *DriverSuite) TestWriteReadStreamsNonUTF8(c *check.C)

TestWriteReadStreamsNonUTF8 tests that non-utf8 data may be written to the storage driver safely.

type DriverTeardown

type DriverTeardown func() error

DriverTeardown is a function which cleans up a suite's storagedriver.StorageDriver.

type SkipCheck

type SkipCheck func() (reason string)

SkipCheck is a function used to determine if a test suite should be skipped. If a SkipCheck returns a non-empty skip reason, the suite is skipped with the given reason.

var NeverSkip SkipCheck = func() string { return "" }

NeverSkip is a default SkipCheck which never skips the suite.

Jump to

Keyboard shortcuts

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