Documentation
¶
Overview ¶
Package test implements a test suite available to all file systems.
Index ¶
- Constants
- func AssertInvalid(tb testing.TB, err error, msgAndArgs ...any) bool
- func AssertLinkError(tb testing.TB, err error) *assertError
- func AssertNoError(tb testing.TB, err error, msgAndArgs ...any) bool
- func AssertPanic(tb testing.TB, funcName string, f func())
- func AssertPathError(tb testing.TB, err error) *assertError
- func FileNilPtr(t *testing.T, f avfs.File)
- func RequireNoError(tb testing.TB, err error, msgAndArgs ...any)
- type GroupInfo
- type PermFunc
- type PermOptions
- type PermTests
- type RaceResult
- type Suite
- func (ts *Suite) BenchAll(b *testing.B)
- func (ts *Suite) BenchCreate(b *testing.B, testDir string)
- func (ts *Suite) BenchFileRead(b *testing.B, testDir string)
- func (ts *Suite) BenchFileWrite(b *testing.B, testDir string)
- func (ts *Suite) BenchMkdir(b *testing.B, testDir string)
- func (ts *Suite) BenchOpenFile(b *testing.B, testDir string)
- func (ts *Suite) BenchRemove(b *testing.B, testDir string)
- func (ts *Suite) CreateGroups(tb testing.TB, suffix string) (groups []avfs.GroupReader)
- func (ts *Suite) CreateUsers(tb testing.TB, suffix string) (users []avfs.UserReader)
- func (ts *Suite) NewPermTests(t *testing.T, testDir, funcName string) *PermTests
- func (ts *Suite) NewPermTestsWithOptions(t *testing.T, testDir, funcName string, options *PermOptions) *PermTests
- func (ts *Suite) RaceCreate(t *testing.T, testDir string)
- func (ts *Suite) RaceCreateTemp(t *testing.T, testDir string)
- func (ts *Suite) RaceFileClose(t *testing.T, testDir string)
- func (ts *Suite) RaceMkdir(t *testing.T, testDir string)
- func (ts *Suite) RaceMkdirAll(t *testing.T, testDir string)
- func (ts *Suite) RaceMkdirRemoveAll(t *testing.T, testDir string)
- func (ts *Suite) RaceMkdirTemp(t *testing.T, testDir string)
- func (ts *Suite) RaceOpen(t *testing.T, testDir string)
- func (ts *Suite) RaceOpenFile(t *testing.T, testDir string)
- func (ts *Suite) RaceOpenFileExcl(t *testing.T, testDir string)
- func (ts *Suite) RaceRemove(t *testing.T, testDir string)
- func (ts *Suite) RaceRemoveAll(t *testing.T, testDir string)
- func (ts *Suite) RunBenchmarks(b *testing.B, userName string, ...)
- func (ts *Suite) RunTests(t *testing.T, userName string, testFuncs ...func(t *testing.T, testDir string))
- func (ts *Suite) TestAbs(t *testing.T, testDir string)
- func (ts *Suite) TestAdminGroupUser(t *testing.T)
- func (ts *Suite) TestBase(t *testing.T, _ string)
- func (ts *Suite) TestChdir(t *testing.T, testDir string)
- func (ts *Suite) TestChmod(t *testing.T, testDir string)
- func (ts *Suite) TestChown(t *testing.T, testDir string)
- func (ts *Suite) TestChroot(t *testing.T, testDir string)
- func (ts *Suite) TestChtimes(t *testing.T, testDir string)
- func (ts *Suite) TestClean(t *testing.T, _ string)
- func (ts *Suite) TestClone(t *testing.T, _ string)
- func (ts *Suite) TestCopyFile(t *testing.T, testDir string)
- func (ts *Suite) TestCreate(t *testing.T, testDir string)
- func (ts *Suite) TestCreateHomeDir(t *testing.T, _ string)
- func (ts *Suite) TestCreateTemp(t *testing.T, testDir string)
- func (ts *Suite) TestDir(t *testing.T, _ string)
- func (ts *Suite) TestDirExists(t *testing.T, testDir string)
- func (ts *Suite) TestEvalSymlink(t *testing.T, testDir string)
- func (ts *Suite) TestExists(t *testing.T, testDir string)
- func (ts *Suite) TestFile(t *testing.T)
- func (ts *Suite) TestFileChdir(t *testing.T, testDir string)
- func (ts *Suite) TestFileChmod(t *testing.T, testDir string)
- func (ts *Suite) TestFileChown(t *testing.T, testDir string)
- func (ts *Suite) TestFileCloseRead(t *testing.T, testDir string)
- func (ts *Suite) TestFileCloseWrite(t *testing.T, testDir string)
- func (ts *Suite) TestFileFd(t *testing.T, testDir string)
- func (ts *Suite) TestFileName(t *testing.T, testDir string)
- func (ts *Suite) TestFileRead(t *testing.T, testDir string)
- func (ts *Suite) TestFileReadAt(t *testing.T, testDir string)
- func (ts *Suite) TestFileReadDir(t *testing.T, testDir string)
- func (ts *Suite) TestFileReaddirnames(t *testing.T, testDir string)
- func (ts *Suite) TestFileSeek(t *testing.T, testDir string)
- func (ts *Suite) TestFileStat(t *testing.T, testDir string)
- func (ts *Suite) TestFileSync(t *testing.T, testDir string)
- func (ts *Suite) TestFileTruncate(t *testing.T, testDir string)
- func (ts *Suite) TestFileWrite(t *testing.T, testDir string)
- func (ts *Suite) TestFileWriteAt(t *testing.T, testDir string)
- func (ts *Suite) TestFileWriteString(t *testing.T, testDir string)
- func (ts *Suite) TestFileWriteTime(t *testing.T, testDir string)
- func (ts *Suite) TestFromToSlash(t *testing.T, _ string)
- func (ts *Suite) TestGlob(t *testing.T, testDir string)
- func (ts *Suite) TestGroupAddDel(t *testing.T)
- func (ts *Suite) TestHashFile(t *testing.T, testDir string)
- func (ts *Suite) TestIdmAll(t *testing.T)
- func (ts *Suite) TestIsAbs(t *testing.T, _ string)
- func (ts *Suite) TestIsDir(t *testing.T, testDir string)
- func (ts *Suite) TestIsEmpty(t *testing.T, testDir string)
- func (ts *Suite) TestIsPathSeparator(t *testing.T, _ string)
- func (ts *Suite) TestJoin(t *testing.T, _ string)
- func (ts *Suite) TestLchown(t *testing.T, testDir string)
- func (ts *Suite) TestLink(t *testing.T, testDir string)
- func (ts *Suite) TestLookup(t *testing.T)
- func (ts *Suite) TestLstat(t *testing.T, testDir string)
- func (ts *Suite) TestMatch(t *testing.T, _ string)
- func (ts *Suite) TestMkSystemDirs(t *testing.T, testDir string)
- func (ts *Suite) TestMkdir(t *testing.T, testDir string)
- func (ts *Suite) TestMkdirAll(t *testing.T, testDir string)
- func (ts *Suite) TestMkdirTemp(t *testing.T, testDir string)
- func (ts *Suite) TestName(t *testing.T, _ string)
- func (ts *Suite) TestOpen(t *testing.T, testDir string)
- func (ts *Suite) TestOpenFileWrite(t *testing.T, testDir string)
- func (ts *Suite) TestPathSeparator(t *testing.T, _ string)
- func (ts *Suite) TestRace(t *testing.T)
- func (ts *Suite) TestReadDir(t *testing.T, testDir string)
- func (ts *Suite) TestReadFile(t *testing.T, testDir string)
- func (ts *Suite) TestReadlink(t *testing.T, testDir string)
- func (ts *Suite) TestRel(t *testing.T, _ string)
- func (ts *Suite) TestRemove(t *testing.T, testDir string)
- func (ts *Suite) TestRemoveAll(t *testing.T, testDir string)
- func (ts *Suite) TestRename(t *testing.T, testDir string)
- func (ts *Suite) TestRndTree(t *testing.T, testDir string)
- func (ts *Suite) TestSameFile(t *testing.T, testDir string)
- func (ts *Suite) TestSetUserByName(t *testing.T, testDir string)
- func (ts *Suite) TestSplit(t *testing.T, _ string)
- func (ts *Suite) TestSplitAbs(t *testing.T, _ string)
- func (ts *Suite) TestStat(t *testing.T, testDir string)
- func (ts *Suite) TestSub(t *testing.T, testDir string)
- func (ts *Suite) TestSymlink(t *testing.T, testDir string)
- func (ts *Suite) TestTempDir(t *testing.T, _ string)
- func (ts *Suite) TestToSysStat(t *testing.T, testDir string)
- func (ts *Suite) TestTruncate(t *testing.T, testDir string)
- func (ts *Suite) TestUMask(t *testing.T, _ string)
- func (ts *Suite) TestUser(t *testing.T, _ string)
- func (ts *Suite) TestUserAddDel(t *testing.T)
- func (ts *Suite) TestUtils(t *testing.T)
- func (ts *Suite) TestVFS(t *testing.T)
- func (ts *Suite) TestVFSAll(t *testing.T)
- func (ts *Suite) TestVolume(t *testing.T, _ string)
- func (ts *Suite) TestWalkDir(t *testing.T, testDir string)
- func (ts *Suite) TestWriteFile(t *testing.T, testDir string)
- func (ts *Suite) TestWriteOnReadOnlyFS(t *testing.T, testDir string)
- func (ts *Suite) TestWriteString(t *testing.T, testDir string)
- func (ts *Suite) VFSSetup() avfs.VFSBase
- func (ts *Suite) VFSTest() avfs.VFSBase
- type UserInfo
Constants ¶
const ( UsrTest = "UsrTest" // UsrTest is used to test user access rights. UsrGrp = "UsrGrp" // UsrGrp is a member of the group GrpTest used to test default group access rights. UsrOth = "UsrOth" // UsrOth is a member of the group GrpOth used to test non-members access rights. )
const ( LinkError errType = "LinkError" PathError errType = "PathError" StringError errType = "StringError" )
Variables ¶
This section is empty.
Functions ¶
func AssertInvalid ¶ added in v0.3.2
AssertInvalid asserts that the error is fs.ErrInvalid.
func AssertLinkError ¶ added in v0.3.2
AssertLinkError checks an error of type os.LinkError.
func AssertNoError ¶ added in v0.3.2
AssertNoError asserts that there is no error (err == nil).
func AssertPanic ¶ added in v0.3.2
AssertPanic checks that function f panics.
func AssertPathError ¶ added in v0.3.2
AssertPathError checks an error of type fs.PathError.
func FileNilPtr ¶ added in v0.3.2
FileNilPtr test calls to File methods when f is a nil File.
Types ¶
type GroupInfo ¶ added in v0.3.2
type GroupInfo struct {
Name string
}
GroupInfo contains information to create a test group.
func GroupInfos ¶ added in v0.3.2
func GroupInfos() []*GroupInfo
GroupInfos returns a GroupInfo slice describing the test groups.
type PermFunc ¶ added in v0.3.2
PermFunc returns an error depending on the permissions of the user and the file mode on the path.
type PermOptions ¶ added in v0.3.2
type PermOptions struct { IgnoreOp bool // IgnoreOp ignores the Op field comparison of fs.PathError or os.LinkError structs. IgnorePath bool // IgnorePath ignores the Path, Old or New field comparison of fs.PathError or os.LinkError errors. CreateFiles bool // CreateFiles creates files instead of directories. }
PermOptions are options for running the tests.
type PermTests ¶ added in v0.3.2
type PermTests struct {
// contains filtered or unexported fields
}
PermTests regroups all tests for a specific function.
type RaceResult ¶ added in v0.3.0
type RaceResult uint8
RaceResult defines the type of result expected from a race test.
const ( // RaceNoneOk expects that all the results will return an error. RaceNoneOk RaceResult = iota + 1 // RaceOneOk expects that only one result will be without error. RaceOneOk // RaceAllOk expects that all results will be without error. RaceAllOk // RaceUndefined does not expect anything (unpredictable results). RaceUndefined )
type Suite ¶ added in v0.3.2
type Suite struct {
// contains filtered or unexported fields
}
Suite is a test suite for virtual file systems and identity managers.
func NewSuiteFS ¶ added in v0.3.2
NewSuiteFS creates a new test suite for a file system.
func NewSuiteIdm ¶ added in v0.3.2
func NewSuiteIdm(tb testing.TB, idm avfs.IdentityMgr) *Suite
NewSuiteIdm creates a new test suite for an identity manager.
func (*Suite) BenchCreate ¶ added in v0.3.2
BenchCreate benchmarks Create function.
func (*Suite) BenchFileRead ¶ added in v0.3.2
func (*Suite) BenchFileWrite ¶ added in v0.3.2
func (*Suite) BenchMkdir ¶ added in v0.3.2
BenchMkdir benchmarks Mkdir function.
func (*Suite) BenchOpenFile ¶ added in v0.3.2
BenchOpenFile benchmarks OpenFile function.
func (*Suite) BenchRemove ¶ added in v0.3.2
BenchRemove benchmarks Remove function.
func (*Suite) CreateGroups ¶ added in v0.3.2
CreateGroups creates and returns test groups with a suffix appended to each group. Errors are ignored if the group already exists.
func (*Suite) CreateUsers ¶ added in v0.3.2
CreateUsers creates and returns test users with a suffix appended to each user. Errors are ignored if the user or his home directory already exists.
func (*Suite) NewPermTests ¶ added in v0.3.2
NewPermTests creates and returns a new environment for permissions test.
func (*Suite) NewPermTestsWithOptions ¶ added in v0.3.2
func (ts *Suite) NewPermTestsWithOptions(t *testing.T, testDir, funcName string, options *PermOptions) *PermTests
NewPermTestsWithOptions creates and returns a new environment for permissions test with options.
func (*Suite) RaceCreate ¶ added in v0.3.2
RaceCreate tests data race conditions for Create.
func (*Suite) RaceCreateTemp ¶ added in v0.3.2
RaceCreateTemp tests data race conditions for CreateTemp.
func (*Suite) RaceFileClose ¶ added in v0.3.2
RaceFileClose tests data race conditions for File.Close.
func (*Suite) RaceMkdirAll ¶ added in v0.3.2
RaceMkdirAll tests data race conditions for MkdirAll.
func (*Suite) RaceMkdirRemoveAll ¶ added in v0.3.2
RaceMkdirRemoveAll test data race conditions for MkdirAll and RemoveAll.
func (*Suite) RaceMkdirTemp ¶ added in v0.3.2
RaceMkdirTemp tests data race conditions for MkdirTemp.
func (*Suite) RaceOpenFile ¶ added in v0.3.2
RaceOpenFile tests data race conditions for OpenFile.
func (*Suite) RaceOpenFileExcl ¶ added in v0.3.2
RaceOpenFileExcl tests data race conditions for OpenFile with O_EXCL flag.
func (*Suite) RaceRemove ¶ added in v0.3.2
RaceRemove tests data race conditions for Remove.
func (*Suite) RaceRemoveAll ¶ added in v0.3.2
RaceRemoveAll tests data race conditions for RemoveAll.
func (*Suite) RunBenchmarks ¶ added in v0.3.2
func (ts *Suite) RunBenchmarks(b *testing.B, userName string, BenchFuncs ...func(b *testing.B, testDir string))
RunBenchmarks runs all benchmark functions specified as user userName.
func (*Suite) RunTests ¶ added in v0.3.2
func (ts *Suite) RunTests(t *testing.T, userName string, testFuncs ...func(t *testing.T, testDir string))
RunTests runs all test functions specified as user userName.
func (*Suite) TestAdminGroupUser ¶ added in v0.3.2
TestAdminGroupUser tests AdminGroup and AdminUser.
func (*Suite) TestChroot ¶ added in v0.3.2
TestChroot tests Chroot function.
func (*Suite) TestChtimes ¶ added in v0.3.2
TestChtimes tests Chtimes function.
func (*Suite) TestCopyFile ¶ added in v0.3.2
TestCopyFile tests avfs.CopyFile function.
func (*Suite) TestCreate ¶ added in v0.3.2
TestCreate tests Create function.
func (*Suite) TestCreateHomeDir ¶ added in v0.3.2
TestCreateHomeDir tests that the user home directory exists and has the correct permissions.
func (*Suite) TestCreateTemp ¶ added in v0.3.2
TestCreateTemp tests CreateTemp function.
func (*Suite) TestDirExists ¶ added in v0.3.2
TestDirExists tests avfs.DirExists function.
func (*Suite) TestEvalSymlink ¶ added in v0.3.2
TestEvalSymlink tests EvalSymlink function.
func (*Suite) TestExists ¶ added in v0.3.2
TestExists tests avfs.Exists function.
func (*Suite) TestFileChdir ¶ added in v0.3.2
TestFileChdir tests File.Chdir function.
func (*Suite) TestFileChmod ¶ added in v0.3.2
TestFileChmod tests File.Chmod function.
func (*Suite) TestFileChown ¶ added in v0.3.2
TestFileChown tests File.Chown function.
func (*Suite) TestFileCloseRead ¶ added in v0.3.2
TestFileCloseRead tests File.Close function for read only files.
func (*Suite) TestFileCloseWrite ¶ added in v0.3.2
TestFileCloseWrite tests File.Close function for read/write files.
func (*Suite) TestFileFd ¶ added in v0.3.2
TestFileFd tests File.Fd function.
func (*Suite) TestFileName ¶ added in v0.3.2
TestFileName tests File.Name function.
func (*Suite) TestFileRead ¶ added in v0.3.2
TestFileRead tests File.Read function.
func (*Suite) TestFileReadAt ¶ added in v0.3.2
TestFileReadAt tests File.ReadAt function.
func (*Suite) TestFileReadDir ¶ added in v0.3.2
TestFileReadDir tests File.ReadDir function.
func (*Suite) TestFileReaddirnames ¶ added in v0.3.2
TestFileReaddirnames tests File.Readdirnames function.
func (*Suite) TestFileSeek ¶ added in v0.3.2
TestFileSeek tests File.Seek function.
func (*Suite) TestFileStat ¶ added in v0.3.2
TestFileStat tests File.Stat function.
func (*Suite) TestFileSync ¶ added in v0.3.2
TestFileSync tests File.Sync function.
func (*Suite) TestFileTruncate ¶ added in v0.3.2
TestFileTruncate tests File.Truncate function.
func (*Suite) TestFileWrite ¶ added in v0.3.2
TestFileWrite tests File.Write function.
func (*Suite) TestFileWriteAt ¶ added in v0.3.2
TestFileWriteAt tests File.WriteAt function.
func (*Suite) TestFileWriteString ¶ added in v0.3.2
TestFileWriteString tests File.WriteString function.
func (*Suite) TestFileWriteTime ¶ added in v0.3.2
TestFileWriteTime checks that modification time is updated on write operations.
func (*Suite) TestFromToSlash ¶ added in v0.3.2
TestFromToSlash tests FromSlash and ToSlash functions.
func (*Suite) TestGroupAddDel ¶ added in v0.3.2
TestGroupAddDel tests GroupAdd and GroupDel functions.
func (*Suite) TestHashFile ¶ added in v0.3.2
TestHashFile tests avfs.HashFile function.
func (*Suite) TestIdmAll ¶ added in v0.3.2
TestIdmAll runs all identity manager tests.
func (*Suite) TestIsEmpty ¶ added in v0.3.2
TestIsEmpty tests avfs.IsEmpty function.
func (*Suite) TestIsPathSeparator ¶ added in v0.3.2
TestIsPathSeparator tests IsPathSeparator function.
func (*Suite) TestLchown ¶ added in v0.3.2
TestLchown tests Lchown function.
func (*Suite) TestLookup ¶ added in v0.3.2
TestLookup tests Lookup* functions.
func (*Suite) TestMkSystemDirs ¶ added in v0.34.0
TestMkSystemDirs tests CreateSystemDirs function.
func (*Suite) TestMkdirAll ¶ added in v0.3.2
TestMkdirAll tests MkdirAll function.
func (*Suite) TestMkdirTemp ¶ added in v0.3.2
TestMkdirTemp tests MkdirTemp function.
func (*Suite) TestOpenFileWrite ¶ added in v0.3.2
TestOpenFileWrite tests OpenFile function for write.
func (*Suite) TestPathSeparator ¶ added in v0.3.2
TestPathSeparator tests PathSeparator function.
func (*Suite) TestReadDir ¶ added in v0.3.2
TestReadDir tests ReadDir function.
func (*Suite) TestReadFile ¶ added in v0.3.2
TestReadFile tests ReadFile function.
func (*Suite) TestReadlink ¶ added in v0.3.2
TestReadlink tests Readlink function.
func (*Suite) TestRemove ¶ added in v0.3.2
TestRemove tests Remove function.
func (*Suite) TestRemoveAll ¶ added in v0.3.2
TestRemoveAll tests RemoveAll function.
func (*Suite) TestRename ¶ added in v0.3.2
TestRename tests Rename function.
func (*Suite) TestRndTree ¶ added in v0.3.2
TestRndTree tests RndTree methods.
func (*Suite) TestSameFile ¶ added in v0.3.2
TestSameFile tests SameFile function.
func (*Suite) TestSetUserByName ¶ added in v0.34.0
func (*Suite) TestSplitAbs ¶ added in v0.3.2
TestSplitAbs tests SplitAbs function.
func (*Suite) TestSymlink ¶ added in v0.3.2
TestSymlink tests Symlink function.
func (*Suite) TestTempDir ¶ added in v0.3.2
TestTempDir tests TempDir function.
func (*Suite) TestToSysStat ¶ added in v0.3.2
TestToSysStat tests ToSysStat function.
func (*Suite) TestTruncate ¶ added in v0.3.2
TestTruncate tests Truncate function.
func (*Suite) TestUserAddDel ¶ added in v0.3.2
TestUserAddDel tests UserAdd and UserDel functions.
func (*Suite) TestVFSAll ¶ added in v0.3.2
TestVFSAll runs all file system tests.
func (*Suite) TestVolume ¶ added in v0.3.2
TestVolume tests VolumeAdd, VolumeDelete and VolumeList functions.
func (*Suite) TestWalkDir ¶ added in v0.3.2
TestWalkDir tests WalkDir function.
func (*Suite) TestWriteFile ¶ added in v0.3.2
TestWriteFile tests WriteFile function.
func (*Suite) TestWriteOnReadOnlyFS ¶ added in v0.3.2
TestWriteOnReadOnlyFS tests all write functions of a read only file system.
func (*Suite) TestWriteString ¶ added in v0.3.2
TestWriteString tests WriteString function.