Documentation ¶
Index ¶
- func CompareDirectoryEntries(e1 []os.FileInfo, e2 []os.FileInfo) error
- func ConsumeWithSpeed(reader io.Reader, chunkSize int, interval time.Duration, stop chan bool) (n int, err error)
- func ConvertSliceOfStringsToMap(input []string) map[string]struct{}
- func DockerCmd(dockerBinary string, c *check.C, args ...string) (string, int)
- func DockerCmdInDir(dockerBinary string, path string, args ...string) (string, int, error)
- func DockerCmdInDirWithTimeout(dockerBinary string, timeout time.Duration, path string, args ...string) (string, int, error)
- func DockerCmdWithError(dockerBinary string, args ...string) (string, int, error)
- func DockerCmdWithStdoutStderr(dockerBinary string, c *check.C, args ...string) (string, string, int)
- func DockerCmdWithTimeout(dockerBinary string, timeout time.Duration, args ...string) (string, int, error)
- func GetExitCode(err error) (int, error)
- func IsKilled(err error) bool
- func ListTar(f io.Reader) ([]string, error)
- func ParseCgroupPaths(procCgroupData string) map[string]string
- func ProcessExitCode(err error) (exitCode int)
- func RandomTmpDirPath(s string, platform string) string
- func RunAtDifferentDate(date time.Time, block func())
- func RunCommand(cmd *exec.Cmd) (exitCode int, err error)
- func RunCommandPipelineWithOutput(cmds ...*exec.Cmd) (output string, exitCode int, err error)
- func RunCommandWithOutput(cmd *exec.Cmd) (output string, exitCode int, err error)
- func RunCommandWithOutputAndTimeout(cmd *exec.Cmd, timeout time.Duration) (output string, exitCode int, err error)
- func RunCommandWithOutputForDuration(cmd *exec.Cmd, duration time.Duration) (output string, exitCode int, timedOut bool, err error)
- func RunCommandWithStdoutStderr(cmd *exec.Cmd) (stdout string, stderr string, exitCode int, err error)
- func UnmarshalJSON(data []byte, result interface{}) error
- type ChannelBuffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareDirectoryEntries ¶
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 ¶
ConvertSliceOfStringsToMap converts a slices of string in a map with the strings as key and an empty string as values.
func DockerCmd ¶
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 ¶
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 ¶
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 ¶
GetExitCode returns the ExitStatus of the specified error if its type is exec.ExitError, returns 0 and an error otherwise.
func IsKilled ¶
IsKilled process the specified error and returns whether the process was killed or not.
func ParseCgroupPaths ¶
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 ¶
ProcessExitCode process the specified error and returns the exit status code if the error was of type exec.ExitError, returns nothing otherwise.
func RandomTmpDirPath ¶
RandomTmpDirPath provides a temporary path with rand string appended. does not create or checks if it exists.
func RunAtDifferentDate ¶
RunAtDifferentDate runs the specified function with the given time. It changes the date of the system, which can led to weird behaviors.
func RunCommand ¶
RunCommand runs the specified command and returns the exitCode different from 0 and the error if something bad happened.
func RunCommandPipelineWithOutput ¶
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 ¶
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 ¶
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) ReadTimeout ¶
ReadTimeout reads the content of the channel in the specified byte array with the specified duration as timeout.