fakes

package
v0.0.0-...-9a89ba0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2014 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeCmdResult

type FakeCmdResult struct {
	Stdout     string
	Stderr     string
	ExitStatus int
	Error      error

	Sticky bool // Set to true if this result should ALWAYS be returned for the given command
}

type FakeCmdRunner

type FakeCmdRunner struct {
	RunComplexCommands   []boshsys.Command
	RunCommands          [][]string
	RunCommandsWithInput [][]string

	CommandExistsValue bool
	AvailableCommands  map[string]bool
	// contains filtered or unexported fields
}

func NewFakeCmdRunner

func NewFakeCmdRunner() *FakeCmdRunner

func (*FakeCmdRunner) AddCmdResult

func (r *FakeCmdRunner) AddCmdResult(fullCmd string, result FakeCmdResult)

func (*FakeCmdRunner) AddProcess

func (r *FakeCmdRunner) AddProcess(fullCmd string, process *FakeProcess)

func (*FakeCmdRunner) CommandExists

func (r *FakeCmdRunner) CommandExists(cmdName string) bool

func (*FakeCmdRunner) RunCommand

func (r *FakeCmdRunner) RunCommand(cmdName string, args ...string) (string, string, int, error)

func (*FakeCmdRunner) RunCommandWithInput

func (r *FakeCmdRunner) RunCommandWithInput(input, cmdName string, args ...string) (string, string, int, error)

func (*FakeCmdRunner) RunComplexCommand

func (r *FakeCmdRunner) RunComplexCommand(cmd boshsys.Command) (string, string, int, error)

func (*FakeCmdRunner) RunComplexCommandAsync

func (r *FakeCmdRunner) RunComplexCommandAsync(cmd boshsys.Command) (boshsys.Process, error)

type FakeFile

type FakeFile struct {
	Stats *FakeFileStats

	WriteErr error
	Contents []byte

	ReadErr   error
	ReadAtErr error

	CloseErr error

	StatErr error
	// contains filtered or unexported fields
}

func NewFakeFile

func NewFakeFile(fs *FakeFileSystem) *FakeFile

func (*FakeFile) Close

func (f *FakeFile) Close() error

func (*FakeFile) Read

func (f *FakeFile) Read(b []byte) (int, error)

func (*FakeFile) ReadAt

func (f *FakeFile) ReadAt(b []byte, offset int64) (int, error)

func (FakeFile) Stat

func (f FakeFile) Stat() (os.FileInfo, error)

func (*FakeFile) Write

func (f *FakeFile) Write(contents []byte) (int, error)

type FakeFileInfo

type FakeFileInfo struct {
	os.FileInfo
	// contains filtered or unexported fields
}

func (FakeFileInfo) IsDir

func (fi FakeFileInfo) IsDir() bool

func (FakeFileInfo) Size

func (fi FakeFileInfo) Size() int64

type FakeFileStats

type FakeFileStats struct {
	FileType FakeFileType

	FileMode os.FileMode
	Username string

	SymlinkTarget string

	Content []byte
}

func (FakeFileStats) StringContents

func (stats FakeFileStats) StringContents() string

type FakeFileSystem

type FakeFileSystem struct {
	HomeDirUsername string
	HomeDirHomePath string

	OpenFileErr error

	ReadFileError error

	WriteToFileError error
	SymlinkError     error

	MkdirAllError error

	ChownErr error
	ChmodErr error

	CopyFileError error

	RenameError    error
	RenameOldPaths []string
	RenameNewPaths []string

	RemoveAllError error

	ReadLinkError error

	TempFileError  error
	ReturnTempFile *os.File

	TempDirDir   string
	TempDirError error

	GlobErr error

	WalkErr error
	// contains filtered or unexported fields
}

func NewFakeFileSystem

func NewFakeFileSystem() *FakeFileSystem

func (*FakeFileSystem) Chmod

func (fs *FakeFileSystem) Chmod(path string, perm os.FileMode) error

func (*FakeFileSystem) Chown

func (fs *FakeFileSystem) Chown(path, username string) error

func (*FakeFileSystem) ConvergeFileContents

func (fs *FakeFileSystem) ConvergeFileContents(path string, content []byte) (bool, error)

func (*FakeFileSystem) CopyFile

func (fs *FakeFileSystem) CopyFile(srcPath, dstPath string) error

func (*FakeFileSystem) FileExists

func (fs *FakeFileSystem) FileExists(path string) bool

func (*FakeFileSystem) GetFileTestStat

func (fs *FakeFileSystem) GetFileTestStat(path string) *FakeFileStats

func (*FakeFileSystem) Glob

func (fs *FakeFileSystem) Glob(pattern string) (matches []string, err error)

func (*FakeFileSystem) HomeDir

func (fs *FakeFileSystem) HomeDir(username string) (string, error)

func (*FakeFileSystem) MkdirAll

func (fs *FakeFileSystem) MkdirAll(path string, perm os.FileMode) error

func (*FakeFileSystem) OpenFile

func (fs *FakeFileSystem) OpenFile(path string, flag int, perm os.FileMode) (boshsys.ReadWriteCloseStater, error)

func (*FakeFileSystem) ReadFile

func (fs *FakeFileSystem) ReadFile(path string) ([]byte, error)

func (*FakeFileSystem) ReadFileString

func (fs *FakeFileSystem) ReadFileString(path string) (string, error)
func (fs *FakeFileSystem) ReadLink(symlinkPath string) (string, error)

func (*FakeFileSystem) RegisterMkdirAllError

func (fs *FakeFileSystem) RegisterMkdirAllError(path string, err error)

func (*FakeFileSystem) RegisterOpenFile

func (fs *FakeFileSystem) RegisterOpenFile(path string, file *FakeFile)

func (*FakeFileSystem) RegisterReadFileError

func (fs *FakeFileSystem) RegisterReadFileError(path string, err error)

func (*FakeFileSystem) RegisterRemoveAllError

func (fs *FakeFileSystem) RegisterRemoveAllError(path string, err error)

func (*FakeFileSystem) RemoveAll

func (fs *FakeFileSystem) RemoveAll(path string) error

func (*FakeFileSystem) Rename

func (fs *FakeFileSystem) Rename(oldPath, newPath string) error

func (*FakeFileSystem) SetGlob

func (fs *FakeFileSystem) SetGlob(pattern string, matches ...[]string)
func (fs *FakeFileSystem) Symlink(oldPath, newPath string) (err error)

func (*FakeFileSystem) TempDir

func (fs *FakeFileSystem) TempDir(prefix string) (string, error)

func (*FakeFileSystem) TempFile

func (fs *FakeFileSystem) TempFile(prefix string) (file *os.File, err error)

func (*FakeFileSystem) Walk

func (fs *FakeFileSystem) Walk(root string, walkFunc filepath.WalkFunc) error

func (*FakeFileSystem) WriteFile

func (fs *FakeFileSystem) WriteFile(path string, content []byte) (err error)

func (*FakeFileSystem) WriteFileString

func (fs *FakeFileSystem) WriteFileString(path, content string) (err error)

type FakeFileType

type FakeFileType string
const (
	FakeFileTypeFile    FakeFileType = "file"
	FakeFileTypeSymlink FakeFileType = "symlink"
	FakeFileTypeDir     FakeFileType = "dir"
)

type FakeProcess

type FakeProcess struct {
	WaitCh chan boshsys.Result

	Waited     bool
	WaitResult boshsys.Result

	TerminatedNicely               bool
	TerminatedNicelyCallBack       func(*FakeProcess)
	TerminateNicelyKillGracePeriod time.Duration
	TerminateNicelyErr             error
}

func (*FakeProcess) TerminateNicely

func (p *FakeProcess) TerminateNicely(killGracePeriod time.Duration) error

func (*FakeProcess) Wait

func (p *FakeProcess) Wait() <-chan boshsys.Result

Jump to

Keyboard shortcuts

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