package
0.0.0-20250312152250-ea85ec9d2454
Repository: https://github.com/snapcore/snapd.git
Documentation: pkg.go.dev

# Functions

No description provided by the author
Backup a single element before further mocking.
Backup the specified list of elements before further mocking.
No description provided by the author
FakeDirEntry returns a fake object implementing fs.DirEntry.
FakeFileInfo returns a fake object implementing os.FileInfo.
HostScaledTimeout returns a timeout for tests that is adjusted for the slowness of certain systems.
Mock provides a type safe way of mocking a single thing.
MockCommand adds a mocked command.
MockLockedCommand is the same as MockCommand(), but the script uses flock to enforce exclusive locking, preventing the call tracking from being corrupted.

# Variables

Contains is a Checker that looks for a elem in a container.
ContainsPadded is a Checker that looks for an expected string in another that might have been padded out to align with something else (so arbitrary amounts of horizontal whitespace is ok between non-whitespace bits).
ContainsWrapped is a Checker that looks for an expected string in another that might have been padded out and wrapped (so arbitrary amounts of whitespace is ok between non-whitespace bits).
DeepContains is a Checker that looks for a elem in a container using DeepEqual.
DeepUnsortedMatches checks if two containers contain the same elements in the same number (but possibly different order) using DeepEqual.
EqualsPadded is a Checker that looks for an expected string to be equal to another except that the other might have been padded out to align with something else (so arbitrary amounts of horizontal whitespace is ok at the ends, and between non-whitespace bits).
EqualsWrapped is a Checker that looks for an expected string to be equal to another except that the other might have been padded out and wrapped (so arbitrary amounts of whitespace is ok at the ends, and between non-whitespace bits).
ErrorIs calls errors.Is with the provided arguments.
FileAbsent verifies that the given file does not exist.
FileContains verifies that the given file's content contains the string (or fmt.Stringer) or []byte provided.
FileEquals verifies that the given file's content is equal to the string (or fmt.Stringer), []byte provided, or the contents referred by a FileContentRef.
Convenient FakeFileInfo objects for InsertLstatResult.
Convenient FakeFileInfo objects for InsertLstatResult.
Convenient FakeFileInfo objects for InsertLstatResult.
FileMatches verifies that the given file's content matches the string provided.
FilePresent verifies that the given file exists.
IntEqual checker verifies that one integer is equal to other integer.
IntGreaterEqual checker verifies that one integer is greater than or equal to other integer.
IntGreaterThan checker verifies that one integer is greater than other integer.
IntLessEqual checker verifies that one integer is less than or equal to other integer.
IntLessThan checker verifies that one integer is less than other integer.
IntNotEqual checker verifies that one integer is not equal to other integer.
IsInterfaceNil checks that the value is a nil interface value (<nil>).
JsonEquals compares the obtained and expected values after having serialized them to JSON and deserialized to a generic interface{} type.
MatchesPadded is a Checker that looks for an expected regexp in a string that might have been padded out to align with something else (so whitespace in the regexp is changed to [ \t]+, and ^[ \t]* is added to the beginning, and [ \t]*$ to the end of it).
MatchesWrapped is a Checker that looks for an expected regexp in a string that might have been padded and wrapped (so whitespace in the regexp is changed to \s+, and (?s)^\s* is added to the beginning, and \s*$ to the end of it).
SymlinkTargetContains verifies that the given file is a symbolic link whose target contains the provided text.
SymlinkTargetEquals verifies that the given file is a symbolic link with the given target.
SymlinkTargetMatches verifies that the given file is a symbolic link whose target matches the provided regular expression.
SyscallsEqual checks that one sequence of system calls is equal to another.

# Structs

BaseTest is a structure used as a base test suite for all the snappy tests.
CallResultError describes a system call and the corresponding result or error.
DBusTest provides a separate dbus session bus for running tests.
MockCmd allows mocking commands for testing.
SyscallRecorder stores which system calls were invoked.

# Type aliases

FileContentRef refers to the content of file by its name, to use in conjunction with FileEquals.