testhelpers

package
v0.0.0-...-02c76fb Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeLVM

type FakeLVM struct {
	mock.Mock
	LvsOutput map[string]*lowlevel.LogicalVolume
}

FakeLVM is mock object implementing lowlevel.LVM

func MakeFakeLvm

func MakeFakeLvm() (lowlevel.LVM, *FakeLVM)

MakeFakeLvm create fake LVM for test injections

func MakeFakeLvmEmpty

func MakeFakeLvmEmpty() (lowlevel.LVM, *FakeLVM)

MakeFakeLvmEmpty create fake LVM for test injections This one created empty

func MakeFakeLvmNonEmpty

func MakeFakeLvmNonEmpty() (lowlevel.LVM, *FakeLVM)

MakeFakeLvmNonEmpty create fake LVM for test injections This one created non-empty, it have group `vg`, consisting of two devices -- /dev/sdc1 and /dev/sdd1

func (*FakeLVM) Blkid

func (f *FakeLVM) Blkid(dev string) (string, error)

Blkid is mock for LVM.Blkid()

func (*FakeLVM) Check

func (f *FakeLVM) Check() error

Check is mock for LVM.Check()

func (*FakeLVM) CheckFilesystemTools

func (f *FakeLVM) CheckFilesystemTools(fstype string) error

CheckFilesystemTools is mock for LVM.CheckFilesystemTools()

func (*FakeLVM) CheckUnit

func (f *FakeLVM) CheckUnit(filename string, content string) (bool, error)

CheckUnit is mock for LVM.CheckUnit()

func (*FakeLVM) CreateLogicalVolume

func (f *FakeLVM) CreateLogicalVolume(group string, volume string, size *lowlevel.LvmSize) error

CreateLogicalVolume is mock for LVM.CreateLogicalVolume()

func (*FakeLVM) CreatePhysicalVolume

func (f *FakeLVM) CreatePhysicalVolume(dev string) error

CreatePhysicalVolume is mock for LVM.CreatePhysicalVolume()

func (*FakeLVM) CreateVolumeGroup

func (f *FakeLVM) CreateVolumeGroup(vg string, devs []string) error

CreateVolumeGroup is mock for LVM.CreateVolumeGroup()

func (*FakeLVM) EvalSymlinks(s string) (string, error)

EvalSymlinks mocks symlink evaluation

func (*FakeLVM) ExtendVolumeGroup

func (f *FakeLVM) ExtendVolumeGroup(vg string, dev string) error

ExtendVolumeGroup is mock for LVM.ExtendVolumeGroup()

func (*FakeLVM) Mkfs

func (f *FakeLVM) Mkfs(dev string, fstype string) error

Mkfs is mock for LVM.Mkfs()

func (*FakeLVM) Mountpoint

func (f *FakeLVM) Mountpoint(path string) (bool, error)

Mountpoint is mock for LVM.Mountpoint()

func (*FakeLVM) QueryLogicalVolumes

func (f *FakeLVM) QueryLogicalVolumes(vg string) (map[string]*lowlevel.LogicalVolume, error)

QueryLogicalVolumes is mock for LVM.QueryLogicalVolumes

func (*FakeLVM) QueryPhysicalVolumes

func (f *FakeLVM) QueryPhysicalVolumes() (map[string]*lowlevel.PhysicalVolume, error)

QueryPhysicalVolumes is mock for LVM.QueryPhysicalVolumes()

func (*FakeLVM) QueryVolumeGroups

func (f *FakeLVM) QueryVolumeGroups() (map[string]*lowlevel.VolumeGroup, error)

QueryVolumeGroups is mock for LVM.QueryVolumeGroups()

func (*FakeLVM) ReduceVolumeGroup

func (f *FakeLVM) ReduceVolumeGroup(vg string, dev string) error

ReduceVolumeGroup is mock for LVM.ReduceVolumeGroup()

func (*FakeLVM) RemovePhysicalVolume

func (f *FakeLVM) RemovePhysicalVolume(dev string, force bool) error

RemovePhysicalVolume is mock for LVM.RemovePhysicalVolume()

func (*FakeLVM) StartUnit

func (f *FakeLVM) StartUnit(unitname string) error

StartUnit is mock for LVM.StartUnit()

func (*FakeLVM) UpdateUnit

func (f *FakeLVM) UpdateUnit(filename string, content string) error

UpdateUnit is mock for LVM.UpdateUnit()

func (*FakeLVM) WaitForDevice

func (f *FakeLVM) WaitForDevice(path string) error

WaitForDevice is mock for LVM.WaitForDevice()

type MockExecutor

type MockExecutor struct {
	mock.Mock

	// NB: need more proper injection for `lvs` executing, return different output on different calls
	// Related issue: https://github.com/asteris-llc/converge/issues/456
	LvsFirstCall bool // ugly hack
}

MockExecutor is a lowlevel.Exec impleentation for faking system interoperation

func MakeLvmWithMockExec

func MakeLvmWithMockExec() (lowlevel.LVM, *MockExecutor)

MakeLvmWithMockExec creates LVM backed with MockExecutor

func (mex *MockExecutor) EvalSymlinks(s string) (string, error)

EvalSymlinks mocks symlink evaluation

func (*MockExecutor) Exists

func (mex *MockExecutor) Exists(path string) (bool, error)

Exists is mock for Exec.Exists()

func (*MockExecutor) Getuid

func (mex *MockExecutor) Getuid() int

Getuid is mock for Getuid()

func (*MockExecutor) Lookup

func (mex *MockExecutor) Lookup(prog string) error

Lookup is mock for Exec.Lookup()

func (*MockExecutor) MkdirAll

func (mex *MockExecutor) MkdirAll(path string, perm os.FileMode) error

MkdirAll is mock for Exec.MkdirAll()

func (*MockExecutor) Read

func (mex *MockExecutor) Read(prog string, args []string) (string, error)

Read is mock for Exec.Read()

func (*MockExecutor) ReadFile

func (mex *MockExecutor) ReadFile(fn string) ([]byte, error)

ReadFile is mock for Exec.ReadFile()

func (*MockExecutor) ReadWithExitCode

func (mex *MockExecutor) ReadWithExitCode(prog string, args []string) (string, int, error)

ReadWithExitCode is mock for Exec.ReadWithExitCode()

func (*MockExecutor) Run

func (mex *MockExecutor) Run(prog string, args []string) error

Run is mock for Exec.Run()

func (*MockExecutor) RunWithExitCode

func (mex *MockExecutor) RunWithExitCode(prog string, args []string) (int, error)

RunWithExitCode is mock for Exec.RunWithExitCode()

func (*MockExecutor) WriteFile

func (mex *MockExecutor) WriteFile(fn string, content []byte, perm os.FileMode) error

WriteFile is mock for Exec.WriteFile()

Jump to

Keyboard shortcuts

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