fstest

package
v0.0.0-...-e7704eb Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package fstest provides utilities for testing the Fs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckListing

func CheckListing(t *testing.T, f fs.Fs, items []Item)

CheckListing checks the fs to see if it has the expected contents

func CheckListingWithPrecision

func CheckListingWithPrecision(t *testing.T, f fs.Fs, items []Item, precision time.Duration)

CheckListingWithPrecision checks the fs to see if it has the expected contents with the given precision.

func CheckTimeEqualWithPrecision

func CheckTimeEqualWithPrecision(t0, t1 time.Time, precision time.Duration) (time.Duration, bool)

CheckTimeEqualWithPrecision checks the times are equal within the precision, returns the delta and a flag

func LocalRemote

func LocalRemote() (path string, err error)

LocalRemote creates a temporary directory name for local remotes

func RandomRemote

func RandomRemote(remoteName string, subdir bool) (fs.Fs, func(), error)

RandomRemote makes a random bucket or subdirectory on the remote

Call the finalise function returned to Purge the fs at the end (and the parent if necessary)

func RandomRemoteName

func RandomRemoteName(remoteName string) (string, string, error)

RandomRemoteName makes a random bucket or subdirectory name

Returns a random remote name plus the leaf name

func RandomString

func RandomString(n int) string

RandomString create a random string for test purposes

func TestMkdir

func TestMkdir(t *testing.T, remote fs.Fs)

TestMkdir tests Mkdir works

func TestPurge

func TestPurge(t *testing.T, remote fs.Fs)

TestPurge tests Purge works

func TestRmdir

func TestRmdir(t *testing.T, remote fs.Fs)

TestRmdir tests Rmdir works

func Time

func Time(timeString string) time.Time

Time parses a time string or logs a fatal error

Types

type Item

type Item struct {
	Path    string
	Md5sum  string
	ModTime time.Time
	Size    int64
	WinPath string
}

Item represents an item for checking

func (*Item) Check

func (i *Item) Check(t *testing.T, obj fs.Object, precision time.Duration)

Check checks all the attributes of the object are correct

func (*Item) CheckModTime

func (i *Item) CheckModTime(t *testing.T, obj fs.Object, modTime time.Time, precision time.Duration)

CheckModTime checks the mod time to the given precision

type Items

type Items struct {
	// contains filtered or unexported fields
}

Items represents all items for checking

func NewItems

func NewItems(items []Item) *Items

NewItems makes an Items

func (*Items) Done

func (is *Items) Done(t *testing.T)

Done checks all finished

func (*Items) Find

func (is *Items) Find(t *testing.T, obj fs.Object, precision time.Duration)

Find checks off an item

Directories

Path Synopsis
Package fstests provides generic tests for testing the Fs and Object interfaces Run go generate to write the tests for the remotes
Package fstests provides generic tests for testing the Fs and Object interfaces Run go generate to write the tests for the remotes

Jump to

Keyboard shortcuts

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