fstest

package
v1.0.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2017 License: Apache-2.0, CC-BY-SA-4.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDirectoryEqual

func CheckDirectoryEqual(d1, d2 string) error

CheckDirectoryEqual compares two directory paths to make sure that the content of the directories is the same.

func CheckDirectoryEqualWithApplier

func CheckDirectoryEqualWithApplier(root string, a Applier) error

CheckDirectoryEqualWithApplier compares directory against applier

func FSSuite

func FSSuite(t *testing.T, a TestApplier)

Types

type Applier

type Applier interface {
	Apply(root string) error
}

Applier applies single file changes

func Apply

func Apply(appliers ...Applier) Applier

Apply returns a new applier from the given appliers

func Chown

func Chown(name string, uid, gid int) Applier

Chown returns a file applier which changes the ownership of a file

func Chtime

func Chtime(name string, t time.Time) Applier

Chtime changes access and mod time of file

func CreateDir

func CreateDir(name string, perm os.FileMode) Applier

CreateDir returns a file applier to create the directory with the provided name and permission

func CreateFile

func CreateFile(name string, content []byte, perm os.FileMode) Applier

CreateFile returns a file applier which creates a file as the provided name with the given content and permission.

func Link(oldname, newname string) Applier

Link returns a file applier which creates a hard link

func Remove

func Remove(name string) Applier

Remove returns a file applier which removes the provided file name

func RemoveAll

func RemoveAll(name string) Applier

RemoveAll returns a file applier which removes the provided file name as in os.RemoveAll

func Rename

func Rename(old, new string) Applier

Rename returns a file applier which renames a file

func SetXAttr

func SetXAttr(name, key, value string) Applier
func Symlink(oldname, newname string) Applier

Symlink returns a file applier which creates a symbolic link

type TestApplier

type TestApplier interface {
	TestContext(context.Context) (context.Context, func(), error)
	Apply(context.Context, Applier) (string, func(), error)
}

Jump to

Keyboard shortcuts

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