test

package
Version: v0.0.0-...-6079644 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeCallbackInvoker

type FakeCallbackInvoker struct {
	CallbackURL string
	Success     bool
	Messages    []string
	Result      []string
}

FakeCallbackInvoker provides the fake callback invoker

func (*FakeCallbackInvoker) ExecuteCallback

func (f *FakeCallbackInvoker) ExecuteCallback(callbackURL string, success bool, messages []string) []string

ExecuteCallback executes the fake callback

type FakeCmdRunner

type FakeCmdRunner struct {
	Name string
	Args []string
	Opts util.CommandOpts
	Err  error
}

FakeCmdRunner provider the fake command runner

func (*FakeCmdRunner) Run

func (f *FakeCmdRunner) Run(name string, args ...string) error

Run runs the fake command runner

func (*FakeCmdRunner) RunWithOptions

func (f *FakeCmdRunner) RunWithOptions(opts util.CommandOpts, name string, args ...string) error

RunWithOptions runs the command runner with extra options

type FakeDocker

type FakeDocker struct {
	LocalRegistryImage           string
	LocalRegistryResult          bool
	LocalRegistryError           error
	RemoveContainerID            string
	RemoveContainerError         error
	DefaultURLImage              string
	DefaultURLResult             string
	DefaultURLError              error
	RunContainerOpts             docker.RunContainerOptions
	RunContainerError            error
	RunContainerErrorBeforeStart bool
	RunContainerContainerID      string
	RunContainerCmd              []string
	GetImageIDImage              string
	GetImageIDResult             string
	GetImageIDError              error
	CommitContainerOpts          docker.CommitContainerOptions
	CommitContainerResult        string
	CommitContainerError         error
	RemoveImageName              string
	RemoveImageError             error
	BuildImageOpts               docker.BuildImageOptions
	BuildImageError              error
	// contains filtered or unexported fields
}

FakeDocker provides a fake docker interface

func (*FakeDocker) BuildImage

func (f *FakeDocker) BuildImage(opts docker.BuildImageOptions) error

BuildImage builds image

func (*FakeDocker) CheckAndPull

func (f *FakeDocker) CheckAndPull(name string) (*dockerclient.Image, error)

CheckAndPull pulls a fake docker image

func (*FakeDocker) CommitContainer

func (f *FakeDocker) CommitContainer(opts docker.CommitContainerOptions) (string, error)

CommitContainer commits a fake Docker container

func (*FakeDocker) GetImageID

func (f *FakeDocker) GetImageID(image string) (string, error)

GetImageID returns a fake Docker image ID

func (*FakeDocker) GetScriptsURL

func (f *FakeDocker) GetScriptsURL(image string) (string, error)

GetScriptsURL returns a default STI scripts URL

func (*FakeDocker) IsImageInLocalRegistry

func (f *FakeDocker) IsImageInLocalRegistry(imageName string) (bool, error)

IsImageInLocalRegistry checks if the image exists in the fake local registry

func (*FakeDocker) PullImage

func (f *FakeDocker) PullImage(imageName string) error

PullImage pulls a fake docker image

func (*FakeDocker) RemoveContainer

func (f *FakeDocker) RemoveContainer(id string) error

RemoveContainer removes a fake Docker container

func (*FakeDocker) RemoveImage

func (f *FakeDocker) RemoveImage(name string) error

RemoveImage removes a fake Docker image

func (*FakeDocker) RunContainer

func (f *FakeDocker) RunContainer(opts docker.RunContainerOptions) error

RunContainer runs a fake Docker container

type FakeDownloader

type FakeDownloader struct {
	URL  []url.URL
	File []string
	Err  map[string]error
	// contains filtered or unexported fields
}

FakeDownloader provides a fake downloader interface

func (*FakeDownloader) DownloadFile

func (f *FakeDownloader) DownloadFile(url *url.URL, targetFile string) (bool, error)

DownloadFile downloads a fake file from the URL

type FakeFileSystem

type FakeFileSystem struct {
	ChmodFile  []string
	ChmodMode  os.FileMode
	ChmodError map[string]error

	RenameFrom  string
	RenameTo    string
	RenameError error

	MkdirAllDir   []string
	MkdirAllError error

	MkdirDir   string
	MkdirError error

	ExistsFile   []string
	ExistsResult map[string]bool

	CopySource string
	CopyDest   string
	CopyError  error

	RemoveDirName  string
	RemoveDirError error

	WorkingDirCalled bool
	WorkingDirResult string
	WorkingDirError  error

	OpenFile       string
	OpenFileResult *FakeReadCloser
	OpenContent    string
	OpenError      error
	OpenCloseError error

	WriteFileName    string
	WriteFileError   error
	WriteFileContent string
	// contains filtered or unexported fields
}

FakeFileSystem provides a fake filesystem structure for testing

func (*FakeFileSystem) Chmod

func (f *FakeFileSystem) Chmod(file string, mode os.FileMode) error

Chmod manipulates permissions on the fake filesystem

func (*FakeFileSystem) Copy

func (f *FakeFileSystem) Copy(sourcePath, targetPath string) error

Copy copies files on the fake filesystem

func (*FakeFileSystem) CreateWorkingDirectory

func (f *FakeFileSystem) CreateWorkingDirectory() (string, error)

CreateWorkingDirectory creates a fake working directory

func (*FakeFileSystem) Exists

func (f *FakeFileSystem) Exists(file string) bool

Exists checks if the file exists in fake filesystem

func (*FakeFileSystem) Mkdir

func (f *FakeFileSystem) Mkdir(dirname string) error

Mkdir creates a new directory on the fake filesystem

func (*FakeFileSystem) MkdirAll

func (f *FakeFileSystem) MkdirAll(dirname string) error

MkdirAll creates a new directories on the fake filesystem

func (*FakeFileSystem) Open

func (f *FakeFileSystem) Open(file string) (io.ReadCloser, error)

Open opens a file

func (*FakeFileSystem) RemoveDirectory

func (f *FakeFileSystem) RemoveDirectory(dir string) error

RemoveDirectory removes a directory in the fake filesystem

func (*FakeFileSystem) Rename

func (f *FakeFileSystem) Rename(from, to string) error

Rename renames files on the fake filesystem

func (*FakeFileSystem) WriteFile

func (f *FakeFileSystem) WriteFile(file string, data []byte) error

Write writes a file

type FakeGit

type FakeGit struct {
	ValidCloneSpecSource string
	ValidCloneSpecResult bool

	CloneSource string
	CloneTarget string
	CloneError  error

	CheckoutRepo  string
	CheckoutRef   string
	CheckoutError error
}

FakeGit provides a fake GIT

func (*FakeGit) Checkout

func (f *FakeGit) Checkout(repo, ref string) error

Checkout checkouts a ref in the fake GIT repository

func (*FakeGit) Clone

func (f *FakeGit) Clone(source, target string) error

Clone clones the fake source GIT repository to target directory

func (*FakeGit) ValidCloneSpec

func (f *FakeGit) ValidCloneSpec(source string) bool

ValidCloneSpec returns a valid GIT clone specification

type FakeInstaller

type FakeInstaller struct {
	Scripts    [][]api.Script
	WorkingDir []string
	Required   []bool

	Download  bool
	ErrScript api.Script
}

FakeInstaller provides a fake installer

func (*FakeInstaller) DownloadAndInstall

func (f *FakeInstaller) DownloadAndInstall(scripts []api.Script, workingDir string, required bool) (bool, error)

DownloadAndInstall downloads and install the fake STI scripts

type FakeReadCloser

type FakeReadCloser struct {
	*bytes.Buffer
	CloseCalled bool
	CloseError  error
}

FakeReadCloser provider a fake ReadCloser

func (*FakeReadCloser) Close

func (f *FakeReadCloser) Close() error

Close closes the fake ReadCloser

type FakeTar

type FakeTar struct {
	CreateTarBase   string
	CreateTarDir    string
	CreateTarResult string
	CreateTarError  error

	ExtractTarDir    string
	ExtractTarReader io.Reader
	ExtractTarError  error
}

FakeTar provides a fake UNIX tar interface

func (*FakeTar) CreateTarFile

func (f *FakeTar) CreateTarFile(base, dir string) (string, error)

CreateTarFile creates a new fake UNIX tar file

func (*FakeTar) ExtractTarStream

func (f *FakeTar) ExtractTarStream(dir string, reader io.Reader) error

ExtractTarStream streams a content of fake tar

Jump to

Keyboard shortcuts

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