converge: github.com/asteris-llc/converge/resource/lvm/testhelpers Index | Files

package testhelpers

import "github.com/asteris-llc/converge/resource/lvm/testhelpers"

Index

Package Files

lvm.go mock.go utils.go

func MakeFakeLvm Uses

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

MakeFakeLvm create fake LVM for test injections

func MakeFakeLvmEmpty Uses

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

MakeFakeLvmEmpty create fake LVM for test injections This one created empty

func MakeFakeLvmNonEmpty Uses

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 MakeLvmWithMockExec Uses

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

MakeLvmWithMockExec creates LVM backed with MockExecutor

type FakeLVM Uses

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

FakeLVM is mock object implementing lowlevel.LVM

func (*FakeLVM) Blkid Uses

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

Blkid is mock for LVM.Blkid()

func (*FakeLVM) Check Uses

func (f *FakeLVM) Check() error

Check is mock for LVM.Check()

func (*FakeLVM) CheckFilesystemTools Uses

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

CheckFilesystemTools is mock for LVM.CheckFilesystemTools()

func (*FakeLVM) CheckUnit Uses

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

CheckUnit is mock for LVM.CheckUnit()

func (*FakeLVM) CreateLogicalVolume Uses

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

CreateLogicalVolume is mock for LVM.CreateLogicalVolume()

func (*FakeLVM) CreatePhysicalVolume Uses

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

CreatePhysicalVolume is mock for LVM.CreatePhysicalVolume()

func (*FakeLVM) CreateVolumeGroup Uses

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 Uses

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

ExtendVolumeGroup is mock for LVM.ExtendVolumeGroup()

func (*FakeLVM) Mkfs Uses

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

Mkfs is mock for LVM.Mkfs()

func (*FakeLVM) Mountpoint Uses

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

Mountpoint is mock for LVM.Mountpoint()

func (*FakeLVM) QueryLogicalVolumes Uses

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

QueryLogicalVolumes is mock for LVM.QueryLogicalVolumes

func (*FakeLVM) QueryPhysicalVolumes Uses

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

QueryPhysicalVolumes is mock for LVM.QueryPhysicalVolumes()

func (*FakeLVM) QueryVolumeGroups Uses

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

QueryVolumeGroups is mock for LVM.QueryVolumeGroups()

func (*FakeLVM) ReduceVolumeGroup Uses

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

ReduceVolumeGroup is mock for LVM.ReduceVolumeGroup()

func (*FakeLVM) RemovePhysicalVolume Uses

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

RemovePhysicalVolume is mock for LVM.RemovePhysicalVolume()

func (*FakeLVM) StartUnit Uses

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

StartUnit is mock for LVM.StartUnit()

func (*FakeLVM) UpdateUnit Uses

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

UpdateUnit is mock for LVM.UpdateUnit()

func (*FakeLVM) WaitForDevice Uses

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

WaitForDevice is mock for LVM.WaitForDevice()

type MockExecutor Uses

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 (mex *MockExecutor) EvalSymlinks(s string) (string, error)

EvalSymlinks mocks symlink evaluation

func (*MockExecutor) Exists Uses

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

Exists is mock for Exec.Exists()

func (*MockExecutor) Getuid Uses

func (mex *MockExecutor) Getuid() int

Getuid is mock for Getuid()

func (*MockExecutor) Lookup Uses

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

Lookup is mock for Exec.Lookup()

func (*MockExecutor) MkdirAll Uses

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

MkdirAll is mock for Exec.MkdirAll()

func (*MockExecutor) Read Uses

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

Read is mock for Exec.Read()

func (*MockExecutor) ReadFile Uses

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

ReadFile is mock for Exec.ReadFile()

func (*MockExecutor) ReadWithExitCode Uses

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

ReadWithExitCode is mock for Exec.ReadWithExitCode()

func (*MockExecutor) Run Uses

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

Run is mock for Exec.Run()

func (*MockExecutor) RunWithExitCode Uses

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

RunWithExitCode is mock for Exec.RunWithExitCode()

func (*MockExecutor) WriteFile Uses

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

WriteFile is mock for Exec.WriteFile()

Package testhelpers imports 4 packages (graph). Updated 2016-12-25. Refresh now. Tools for package owners.