integration

package
v1.4.2-0...-2180dd6 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2015 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareDirectoryEntries

func CompareDirectoryEntries(e1 []os.FileInfo, e2 []os.FileInfo) error

CompareDirectoryEntries compares two sets of FileInfo (usually taken from a directory) and returns an error if different.

func ConsumeWithSpeed

func ConsumeWithSpeed(reader io.Reader, chunkSize int, interval time.Duration, stop chan bool) (n int, err error)

ConsumeWithSpeed reads chunkSize bytes from reader after every interval. Returns total read bytes.

func ConvertSliceOfStringsToMap

func ConvertSliceOfStringsToMap(input []string) map[string]struct{}

ConvertSliceOfStringsToMap converts a slices of string in a map with the strings as key and an empty string as values.

func DockerCmd

func DockerCmd(dockerBinary string, c *check.C, args ...string) (string, int)

DockerCmd executes a docker command and returns the output and the exit code. If the command returns an error, it will fail and stop the tests.

func DockerCmdInDir

func DockerCmdInDir(dockerBinary string, path string, args ...string) (string, int, error)

DockerCmdInDir executes a docker command in a directory and returns the output, the exit code and the error (if any).

func DockerCmdInDirWithTimeout

func DockerCmdInDirWithTimeout(dockerBinary string, timeout time.Duration, path string, args ...string) (string, int, error)

DockerCmdInDirWithTimeout executes a docker command in a directory with a timeout and returns the output, the exit code and the error (if any).

func DockerCmdWithError

func DockerCmdWithError(dockerBinary string, args ...string) (string, int, error)

DockerCmdWithError executes a docker command that is supposed to fail and returns the output, the exit code and the error.

func DockerCmdWithStdoutStderr

func DockerCmdWithStdoutStderr(dockerBinary string, c *check.C, args ...string) (string, string, int)

DockerCmdWithStdoutStderr executes a docker command and returns the content of the stdout, stderr and the exit code. If a check.C is passed, it will fail and stop tests if the error is not nil.

func DockerCmdWithTimeout

func DockerCmdWithTimeout(dockerBinary string, timeout time.Duration, args ...string) (string, int, error)

DockerCmdWithTimeout executes a docker command with a timeout, and returns the output, the exit code and the error (if any).

func GetExitCode

func GetExitCode(err error) (int, error)

GetExitCode returns the ExitStatus of the specified error if its type is exec.ExitError, returns 0 and an error otherwise.

func IsKilled

func IsKilled(err error) bool

IsKilled process the specified error and returns whether the process was killed or not.

func ListTar

func ListTar(f io.Reader) ([]string, error)

ListTar lists the entries of a tar.

func ParseCgroupPaths

func ParseCgroupPaths(procCgroupData string) map[string]string

ParseCgroupPaths parses 'procCgroupData', which is output of '/proc/<pid>/cgroup', and returns a map which cgroup name as key and path as value.

func ProcessExitCode

func ProcessExitCode(err error) (exitCode int)

ProcessExitCode process the specified error and returns the exit status code if the error was of type exec.ExitError, returns nothing otherwise.

func RandomTmpDirPath

func RandomTmpDirPath(s string, platform string) string

RandomTmpDirPath provides a temporary path with rand string appended. does not create or checks if it exists.

func RunAtDifferentDate

func RunAtDifferentDate(date time.Time, block func())

RunAtDifferentDate runs the specified function with the given time. It changes the date of the system, which can led to weird behaviors.

func RunCommand

func RunCommand(cmd *exec.Cmd) (exitCode int, err error)

RunCommand runs the specified command and returns the exitCode different from 0 and the error if something bad happened.

func RunCommandPipelineWithOutput

func RunCommandPipelineWithOutput(cmds ...*exec.Cmd) (output string, exitCode int, err error)

RunCommandPipelineWithOutput runs the array of commands with the output of each pipelined with the following (like cmd1 | cmd2 | cmd3 would do). It returns the final output, the exitCode different from 0 and the error if something bad happened.

func RunCommandWithOutput

func RunCommandWithOutput(cmd *exec.Cmd) (output string, exitCode int, err error)

RunCommandWithOutput runs the specified command and returns the combined output (stdout/stderr) with the exitCode different from 0 and the error if something bad happened

func RunCommandWithOutputAndTimeout

func RunCommandWithOutputAndTimeout(cmd *exec.Cmd, timeout time.Duration) (output string, exitCode int, err error)

RunCommandWithOutputAndTimeout runs the specified command "timeboxed" by the specified duration. It returns the output with the exitCode different from 0 and the error if something bad happened or if the process timed out (and has been killed).

func RunCommandWithOutputForDuration

func RunCommandWithOutputForDuration(cmd *exec.Cmd, duration time.Duration) (output string, exitCode int, timedOut bool, err error)

RunCommandWithOutputForDuration runs the specified command "timeboxed" by the specified duration. If the process is still running when the timebox is finished, the process will be killed and . It will returns the output with the exitCode different from 0 and the error if something bad happened and a boolean whether it has been killed or not.

func RunCommandWithStdoutStderr

func RunCommandWithStdoutStderr(cmd *exec.Cmd) (stdout string, stderr string, exitCode int, err error)

RunCommandWithStdoutStderr runs the specified command and returns stdout and stderr separately with the exitCode different from 0 and the error if something bad happened

func UnmarshalJSON

func UnmarshalJSON(data []byte, result interface{}) error

UnmarshalJSON deserialize a JSON in the given interface.

Types

type ChannelBuffer

type ChannelBuffer struct {
	C chan []byte
}

ChannelBuffer holds a chan of byte array that can be populate in a goroutine.

func (*ChannelBuffer) Close

func (c *ChannelBuffer) Close() error

Close closes the go channel.

func (*ChannelBuffer) ReadTimeout

func (c *ChannelBuffer) ReadTimeout(p []byte, n time.Duration) (int, error)

ReadTimeout reads the content of the channel in the specified byte array with the specified duration as timeout.

func (*ChannelBuffer) Write

func (c *ChannelBuffer) Write(b []byte) (int, error)

Write implements Writer.

Directories

Path Synopsis
Package checker provide Docker specific implementations of the go-check.Checker interface.
Package checker provide Docker specific implementations of the go-check.Checker interface.

Jump to

Keyboard shortcuts

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