package testing
import "github.com/containerd/containerd/pkg/os/testing"
Index ¶
- type CalledDetail
- type FakeOS
- func NewFakeOS() *FakeOS
- func (f *FakeOS) ClearErrors()
- func (f *FakeOS) CopyFile(src, dest string, perm os.FileMode) error
- func (f *FakeOS) FollowSymlinkInScope(path, scope string) (string, error)
- func (f *FakeOS) GetCalls() []CalledDetail
- func (f *FakeOS) Hostname() (string, error)
- func (f *FakeOS) InjectError(fn string, err error)
- func (f *FakeOS) InjectErrors(errs map[string]error)
- func (f *FakeOS) LookupMount(path string) (containerdmount.Info, error)
- func (f *FakeOS) MkdirAll(path string, perm os.FileMode) error
- func (f *FakeOS) Mount(source string, target string, fstype string, flags uintptr, data string) error
- func (f *FakeOS) RemoveAll(path string) error
- func (f *FakeOS) ResolveSymbolicLink(path string) (string, error)
- func (f *FakeOS) Stat(name string) (os.FileInfo, error)
- func (f *FakeOS) Unmount(target string) error
- func (f *FakeOS) WriteFile(filename string, data []byte, perm os.FileMode) error
Types ¶
type CalledDetail ¶
type CalledDetail struct { // Name of the function called. Name string // Arguments of the function called. Arguments []interface{} }
CalledDetail is the struct contains called function name and arguments.
type FakeOS ¶
type FakeOS struct { sync.Mutex MkdirAllFn func(string, os.FileMode) error RemoveAllFn func(string) error StatFn func(string) (os.FileInfo, error) ResolveSymbolicLinkFn func(string) (string, error) FollowSymlinkInScopeFn func(string, string) (string, error) CopyFileFn func(string, string, os.FileMode) error WriteFileFn func(string, []byte, os.FileMode) error MountFn func(source string, target string, fstype string, flags uintptr, data string) error UnmountFn func(target string) error LookupMountFn func(path string) (containerdmount.Info, error) HostnameFn func() (string, error) // contains filtered or unexported fields }
FakeOS mocks out certain OS calls to avoid perturbing the filesystem If a member of the form `*Fn` is set, that function will be called in place of the real call.
func NewFakeOS ¶
func NewFakeOS() *FakeOS
NewFakeOS creates a FakeOS.
func (*FakeOS) ClearErrors ¶
func (f *FakeOS) ClearErrors()
ClearErrors clear errors for call
func (*FakeOS) CopyFile ¶
CopyFile is a fake call that invokes CopyFileFn or just return nil.
func (*FakeOS) FollowSymlinkInScope ¶
FollowSymlinkInScope is a fake call that invokes FollowSymlinkInScope or returns its input
func (*FakeOS) GetCalls ¶
func (f *FakeOS) GetCalls() []CalledDetail
GetCalls get detail of calls.
func (*FakeOS) Hostname ¶
Hostname is a fake call that invokes HostnameFn or just return nil.
func (*FakeOS) InjectError ¶
InjectError inject error for call
func (*FakeOS) InjectErrors ¶
InjectErrors inject errors for calls
func (*FakeOS) LookupMount ¶
func (f *FakeOS) LookupMount(path string) (containerdmount.Info, error)
LookupMount is a fake call that invokes LookupMountFn or just return nil.
func (*FakeOS) MkdirAll ¶
MkdirAll is a fake call that invokes MkdirAllFn or just returns nil.
func (*FakeOS) Mount ¶
func (f *FakeOS) Mount(source string, target string, fstype string, flags uintptr, data string) error
Mount is a fake call that invokes MountFn or just return nil.
func (*FakeOS) RemoveAll ¶
RemoveAll is a fake call that invokes RemoveAllFn or just returns nil.
func (*FakeOS) ResolveSymbolicLink ¶
ResolveSymbolicLink is a fake call that invokes ResolveSymbolicLinkFn or returns its input
func (*FakeOS) Stat ¶
Stat is a fake call that invokes StatFn or just return nil.
func (*FakeOS) Unmount ¶
Unmount is a fake call that invokes UnmountFn or just return nil.
func (*FakeOS) WriteFile ¶
WriteFile is a fake call that invokes WriteFileFn or just return nil.
Source Files ¶
- Version
- v1.7.0-beta.4
- Published
- Feb 16, 2023
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 8 seconds ago –
Tools for package owners.