Documentation
¶
Index ¶
- type ErrorMounter
- func (e ErrorMounter) GetMountRefs(pathname string) ([]string, error)
- func (e ErrorMounter) IsLikelyNotMountPoint(file string) (bool, error)
- func (e ErrorMounter) List() ([]mount.MountPoint, error)
- func (e ErrorMounter) Mount(source string, target string, fstype string, options []string) error
- func (e ErrorMounter) MountSensitive(source string, target string, fstype string, options []string, ...) error
- func (e ErrorMounter) MountSensitiveWithoutSystemd(source string, target string, fstype string, options []string, ...) error
- func (e ErrorMounter) MountSensitiveWithoutSystemdWithMountFlags(source string, target string, fstype string, options []string, ...) error
- func (e ErrorMounter) Unmount(target string) error
- type FakeCloudInitRunner
- type FakeHTTPClient
- type FakeImageExtractor
- type FakeMount
- type FakeRunner
- func (r *FakeRunner) ClearCmds()
- func (r FakeRunner) CmdsMatch(cmdList [][]string) error
- func (r *FakeRunner) GetLogger() *sdkTypes.KairosLogger
- func (r FakeRunner) IncludesCmds(cmdList [][]string) error
- func (r *FakeRunner) InitCmd(command string, args ...string) *exec.Cmd
- func (r FakeRunner) MatchMilestones(cmdList [][]string) error
- func (r *FakeRunner) Run(command string, args ...string) ([]byte, error)
- func (r *FakeRunner) RunCmd(cmd *exec.Cmd) ([]byte, error)
- func (r *FakeRunner) SetLogger(logger *sdkTypes.KairosLogger)
- type FakeSyscall
- func (f *FakeSyscall) Chdir(path string) error
- func (f *FakeSyscall) Chroot(path string) error
- func (f *FakeSyscall) Mount(source string, target string, fstype string, flags uintptr, data string) error
- func (f *FakeSyscall) Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
- func (f *FakeSyscall) WasChrootCalledWith(path string) bool
- func (f *FakeSyscall) WasMountCalledWith(source string, target string, fstype string, flags uintptr, data string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorMounter ¶
ErrorMounter is a fake mounter for tests that can error out.
func NewErrorMounter ¶
func NewErrorMounter() *ErrorMounter
NewErrorMounter returns an ErrorMounter with an instance of FakeMounter inside so we can use its functions
func (ErrorMounter) GetMountRefs ¶
func (e ErrorMounter) GetMountRefs(pathname string) ([]string, error)
func (ErrorMounter) IsLikelyNotMountPoint ¶
func (e ErrorMounter) IsLikelyNotMountPoint(file string) (bool, error)
func (ErrorMounter) List ¶
func (e ErrorMounter) List() ([]mount.MountPoint, error)
func (ErrorMounter) MountSensitive ¶
func (ErrorMounter) MountSensitiveWithoutSystemd ¶
func (ErrorMounter) MountSensitiveWithoutSystemdWithMountFlags ¶
func (ErrorMounter) Unmount ¶
func (e ErrorMounter) Unmount(target string) error
Unmount will return an error if ErrorOnUnmount is true
type FakeCloudInitRunner ¶
func (*FakeCloudInitRunner) Analyze ¶ added in v2.14.2
func (ci *FakeCloudInitRunner) Analyze(stage string, args ...string)
func (*FakeCloudInitRunner) Run ¶
func (ci *FakeCloudInitRunner) Run(stage string, args ...string) error
func (*FakeCloudInitRunner) SetModifier ¶
func (ci *FakeCloudInitRunner) SetModifier(modifier schema.Modifier)
type FakeHTTPClient ¶
FakeHTTPClient is an implementation of HTTPClient interface used for testing It stores Get calls into ClientCalls for easy checking of what was called
func (*FakeHTTPClient) GetURL ¶
func (m *FakeHTTPClient) GetURL(log sdkTypes.KairosLogger, url string, destination string) error
GetURL will return a FakeHttpBody and store the url call into ClientCalls
func (*FakeHTTPClient) WasGetCalledWith ¶
func (m *FakeHTTPClient) WasGetCalledWith(url string) bool
WasGetCalledWith is a helper method to confirm that the client wazs called with the give url
type FakeImageExtractor ¶
type FakeImageExtractor struct { Logger sdkTypes.KairosLogger SideEffect func(imageRef, destination, platformRef string) error }
func NewFakeImageExtractor ¶
func NewFakeImageExtractor(logger sdkTypes.KairosLogger) *FakeImageExtractor
func (FakeImageExtractor) ExtractImage ¶
func (f FakeImageExtractor) ExtractImage(imageRef, destination, platformRef string) error
func (FakeImageExtractor) GetOCIImageSize ¶
func (f FakeImageExtractor) GetOCIImageSize(imageRef, platformRef string) (int64, error)
type FakeRunner ¶
type FakeRunner struct { ReturnValue []byte SideEffect func(command string, args ...string) ([]byte, error) ReturnError error Logger *sdkTypes.KairosLogger // contains filtered or unexported fields }
func NewFakeRunner ¶
func NewFakeRunner() *FakeRunner
func (*FakeRunner) ClearCmds ¶
func (r *FakeRunner) ClearCmds()
func (FakeRunner) CmdsMatch ¶
func (r FakeRunner) CmdsMatch(cmdList [][]string) error
CmdsMatch matches the commands list in order. Note HasPrefix is being used to evaluate the match, so expecting initial part of the command is enough to get a match. It facilitates testing commands with dynamic arguments (aka temporary files)
func (*FakeRunner) GetLogger ¶
func (r *FakeRunner) GetLogger() *sdkTypes.KairosLogger
func (FakeRunner) IncludesCmds ¶
func (r FakeRunner) IncludesCmds(cmdList [][]string) error
IncludesCmds checks the given commands were executed in any order. Note it uses HasPrefix to match commands, see CmdsMatch.
func (FakeRunner) MatchMilestones ¶
func (r FakeRunner) MatchMilestones(cmdList [][]string) error
MatchMilestones matches all the given commands were executed in the provided order. Note it uses HasPrefix to match commands, see CmdsMatch.
func (*FakeRunner) SetLogger ¶
func (r *FakeRunner) SetLogger(logger *sdkTypes.KairosLogger)
type FakeSyscall ¶
type FakeSyscall struct { ErrorOnChroot bool ReturnValue int // What to return when FakeSyscall.Syscall is called SideEffectSyscall func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) // Function to stub the result of calling FakeSyscall.Syscall // contains filtered or unexported fields }
FakeSyscall is a test helper method to track calls to syscall It can also fail on Chroot command
func (*FakeSyscall) Chdir ¶
func (f *FakeSyscall) Chdir(path string) error
func (*FakeSyscall) Chroot ¶
func (f *FakeSyscall) Chroot(path string) error
Chroot will store the chroot call It can return a failure if ErrorOnChroot is true
func (*FakeSyscall) Syscall ¶ added in v2.14.0
func (f *FakeSyscall) Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
func (*FakeSyscall) WasChrootCalledWith ¶
func (f *FakeSyscall) WasChrootCalledWith(path string) bool
WasChrootCalledWith is a helper method to check if Chroot was called with the given path