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 IsKilled(err error) bool
- func ListTar(f io.Reader) ([]string, error)
- func ParseCgroupPaths(procCgroupData string) map[string]string
- func RandomTmpDirPath(s string, platform string) string
- func ReadBody(b io.ReadCloser) ([]byte, error)
- func RunAtDifferentDate(date time.Time, block func())
- func RunCommandPipelineWithOutput(cmds ...*exec.Cmd) (output string, exitCode int, err 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 before sleeping for interval duration. Returns total read bytes. Send true to the stop channel to return before reading to EOF on the reader.
func ConvertSliceOfStringsToMap ¶
ConvertSliceOfStringsToMap converts a slices of string in a map with the strings as key and an empty string as values.
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 RandomTmpDirPath ¶
RandomTmpDirPath provides a temporary path with rand string appended. does not create or checks if it exists.
func ReadBody ¶
func ReadBody(b io.ReadCloser) ([]byte, error)
ReadBody read the specified ReadCloser content and returns it
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 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.
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.
Directories ¶
Path | Synopsis |
---|---|
Package assert contains functions for making assertions in unit tests
|
Package assert contains functions for making assertions in unit tests |
Package golden provides function and helpers to use golden file for testing purpose.
|
Package golden provides function and helpers to use golden file for testing purpose. |