tests

package
v0.0.0-...-7c31ad9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllFixtures = []struct {
	Name  string
	Files []FixtureFile
}{
	{"Alpha", FixtureAlpha},
	{"AlphaDiffContent", FixtureAlphaDiffContent},
	{"AlphaDiffTime", FixtureAlphaDiffTime},
	{"AlphaDiffPerm", FixtureAlphaDiffPerm},
	{"AlphaDiffPerm2", FixtureAlphaDiffPerm2},
	{"AlphaDiffPerm3", FixtureAlphaDiffPerm3},
	{"AlphaDiffUidGid", FixtureAlphaDiffUidGid},
	{"Empty", FixtureEmpty},
	{"Multifile", FixtureMultifile},
	{"Depth1", FixtureDepth1},
	{"Depth3", FixtureDepth3},
	{"Symlinks", FixtureSymlinks},
	{"Gamma", FixtureGamma},
}
View Source
var FixtureAlpha = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./a"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 3}, []byte("zyx")},
}
View Source
var FixtureAlphaDiffContent = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./a"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 3}, []byte("qwe")},
}
View Source
var FixtureAlphaDiffPerm = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./a"), Type: fs.Type_File, Perms: 0600, Mtime: defaultTime, Size: 3}, []byte("zyx")},
}
View Source
var FixtureAlphaDiffPerm2 = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},

	{fs.Metadata{Name: fs.MustRelPath("./a"), Type: fs.Type_File, Perms: 0664, Mtime: defaultTime, Size: 3}, []byte("zyx")},
}
View Source
var FixtureAlphaDiffPerm3 = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},

	{fs.Metadata{Name: fs.MustRelPath("./a"), Type: fs.Type_File, Perms: 07644, Mtime: defaultTime, Size: 3}, []byte("zyx")},
}
View Source
var FixtureAlphaDiffTime = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./a"), Type: fs.Type_File, Perms: 0644, Mtime: time.Date(2004, 10, 14, 4, 3, 2, 0, time.UTC), Size: 3}, []byte("zyx")},
}
View Source
var FixtureAlphaDiffUidGid = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./a"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 3, Uid: 444, Gid: 444}, []byte("zyx")},
}
View Source
var FixtureDepth1 = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./a"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 3}, []byte("zyx")},
	{fs.Metadata{Name: fs.MustRelPath("./d"), Type: fs.Type_Dir, Perms: 0750, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./d/c"), Type: fs.Type_File, Perms: 0664, Mtime: defaultTime, Size: 4}, []byte("asdf")},
}
View Source
var FixtureDepth3 = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./a"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 3}, []byte("zyx")},
	{fs.Metadata{Name: fs.MustRelPath("./d"), Type: fs.Type_Dir, Perms: 0750, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./d/d2"), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./d/d2/c"), Type: fs.Type_File, Perms: 0664, Mtime: defaultTime, Size: 4}, []byte("asdf")},
}
View Source
var FixtureEmpty = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
}
View Source
var FixtureGamma = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./etc"), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./etc/init.d/"), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./etc/init.d/service-p"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 2}, []byte("p!")},
	{fs.Metadata{Name: fs.MustRelPath("./etc/init.d/service-q"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 2}, []byte("q!")},
	{fs.Metadata{Name: fs.MustRelPath("./etc/init/"), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./etc/init/zed"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 4}, []byte("grue")},
	{fs.Metadata{Name: fs.MustRelPath("./etc/trick"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 3}, []byte("sib")},
	{fs.Metadata{Name: fs.MustRelPath("./etc/tricky"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 3}, []byte("sob")},
	{fs.Metadata{Name: fs.MustRelPath("./var"), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./var/fun"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 3}, []byte("zyx")},
}

deep and varied structures. files and dirs. subtle: a dir with a sibling that's a suffix of its name (can trip up dir/child adjacency sorting). subtle: a file with a sibling that's a suffix of its name (other half of the test, to make sure the prefix doesn't create an incorrect tree node).

View Source
var FixtureMultifile = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./a"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 3}, []byte("zyx")},
	{fs.Metadata{Name: fs.MustRelPath("./b"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 3}, []byte("qwe")},
}
View Source
var FixtureSymlinks = []FixtureFile{
	{fs.Metadata{Name: fs.MustRelPath("."), Type: fs.Type_Dir, Perms: 0755, Mtime: defaultTime}, nil},
	{fs.Metadata{Name: fs.MustRelPath("./a"), Type: fs.Type_File, Perms: 0644, Mtime: defaultTime, Size: 3}, []byte("zyx")},

	{fs.Metadata{Name: fs.MustRelPath("./ln"), Type: fs.Type_Symlink, Perms: 0777, Mtime: defaultTime, Linkname: "./a"}, nil},
}

Functions

func CheckCachePopulation

func CheckCachePopulation(packType api.PackType, pack rio.PackFunc, unpack rio.UnpackFunc, warehouseAddr api.WarehouseLocation)

func CheckMirror

func CheckMirror(packType api.PackType, mirror rio.MirrorFunc, pack rio.PackFunc, unpack rio.UnpackFunc, target api.WarehouseLocation, source api.WarehouseLocation)

func CheckPackErrorsGracefully

func CheckPackErrorsGracefully(packType api.PackType, pack rio.PackFunc)

func CheckPackHashVariesOnVariations

func CheckPackHashVariesOnVariations(packType api.PackType, pack rio.PackFunc)

func CheckPackProducesConsistentHash

func CheckPackProducesConsistentHash(packType api.PackType, pack rio.PackFunc)

func CheckRoundTrip

func CheckRoundTrip(packType api.PackType, pack rio.PackFunc, unpack rio.UnpackFunc, warehouseAddr api.WarehouseLocation)

func PlaceFixture

func PlaceFixture(afs fs.FS, fixture []FixtureFile)

Create files described by the fixtures on the filesystem given. Any errors will be panicked, since this is meant to be used in test setup.

Types

type FixtureFile

type FixtureFile struct {
	Metadata fs.Metadata
	Body     []byte
}

Jump to

Keyboard shortcuts

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