Documentation ¶
Index ¶
- Variables
- func Containerized() bool
- func CreateTempDirInTempDir() (string, error)
- func IsCommandAvailable(command string) bool
- func IsKernelNewerThan(version string) (bool, error)
- func StringInSlice(s string, sl []string) bool
- func WaitContainerReady(p PodmanTestCommon, id string, expStr string, timeout int, step int) bool
- func WaitForContainer(p PodmanTestCommon) bool
- func WriteJsonFile(data []byte, filePath string) error
- type HostOS
- type PodmanSession
- func (s *PodmanSession) ErrorGrepString(term string) (bool, []string)
- func (s *PodmanSession) ErrorToString() string
- func (s *PodmanSession) ErrorToStringArray() []string
- func (s *PodmanSession) GrepString(term string) (bool, []string)
- func (s *PodmanSession) IsJSONOutputValid() bool
- func (s *PodmanSession) LineInOuputStartsWith(term string) bool
- func (s *PodmanSession) LineInOutputContains(term string) bool
- func (s *PodmanSession) LineInOutputContainsTag(repo, tag string) bool
- func (s *PodmanSession) OutputToString() string
- func (s *PodmanSession) OutputToStringArray() []string
- func (s *PodmanSession) WaitWithDefaultTimeout()
- type PodmanTest
- func (p *PodmanTest) GetContainerStatus() string
- func (p *PodmanTest) MakeOptions(args []string) []string
- func (p *PodmanTest) NumberOfContainers() int
- func (p *PodmanTest) NumberOfContainersRunning() int
- func (p *PodmanTest) NumberOfPods() int
- func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, cwd string, env []string, nocache bool) *PodmanSession
- func (p *PodmanTest) PodmanBase(args []string, nocache bool) *PodmanSession
- func (p *PodmanTest) WaitContainerReady(id string, expStr string, timeout int, step int) bool
- func (p *PodmanTest) WaitForContainer() bool
- type PodmanTestCommon
Constants ¶
This section is empty.
Variables ¶
var ( OSReleasePath = "/etc/os-release" ProcessOneCgroupPath = "/proc/1/cgroup" )
Functions ¶
func Containerized ¶
func Containerized() bool
Containerized check the podman command run inside container
func CreateTempDirInTempDir ¶
CreateTempDirinTempDir create a temp dir with prefix podman_test
func IsCommandAvailable ¶
IsCommandAvaible check if command exist
func IsKernelNewerThan ¶
IsKernelNewerThan compares the current kernel version to one provided. If the kernel is equal to or greater, returns true
func StringInSlice ¶
StringInSlice determines if a string is in a string slice, returns bool
func WaitContainerReady ¶
WaitForContainerReady is a wrapper function for accept inheritance PodmanTest struct.
func WaitForContainer ¶
func WaitForContainer(p PodmanTestCommon) bool
WaitForContainer is a wrapper function for accept inheritance PodmanTest struct.
func WriteJsonFile ¶
WriteJsonFile write json format data to a json file
Types ¶
type HostOS ¶
HostOS is a simple struct for the test os
func GetHostDistributionInfo ¶
func GetHostDistributionInfo() HostOS
GetHostDistributionInfo returns a struct with its distribution name and version
type PodmanSession ¶
PodmanSession wraps the gexec.session so we can extend it
func SystemExec ¶
func SystemExec(command string, args []string) *PodmanSession
SystemExec is used to exec a system command to check its exit code or output
func (*PodmanSession) ErrorGrepString ¶
func (s *PodmanSession) ErrorGrepString(term string) (bool, []string)
ErrorGrepString takes session stderr output and behaves like grep. it returns a bool if successful and an array of strings on positive matches
func (*PodmanSession) ErrorToString ¶
func (s *PodmanSession) ErrorToString() string
ErrorToString formats session stderr to string
func (*PodmanSession) ErrorToStringArray ¶
func (s *PodmanSession) ErrorToStringArray() []string
ErrorToStringArray returns the stderr output as a []string where each array item is a line split by newline
func (*PodmanSession) GrepString ¶
func (s *PodmanSession) GrepString(term string) (bool, []string)
GrepString takes session output and behaves like grep. it returns a bool if successful and an array of strings on positive matches
func (*PodmanSession) IsJSONOutputValid ¶
func (s *PodmanSession) IsJSONOutputValid() bool
IsJSONOutputValid attempts to unmarshal the session buffer and if successful, returns true, else false
func (*PodmanSession) LineInOuputStartsWith ¶
func (s *PodmanSession) LineInOuputStartsWith(term string) bool
LineInOutputStartsWith returns true if a line in a session output starts with the supplied string
func (*PodmanSession) LineInOutputContains ¶
func (s *PodmanSession) LineInOutputContains(term string) bool
LineInOutputContains returns true if a line in a session output contains the supplied string
func (*PodmanSession) LineInOutputContainsTag ¶
func (s *PodmanSession) LineInOutputContainsTag(repo, tag string) bool
LineInOutputContainsTag returns true if a line in the session's output contains the repo-tag pair as returned by podman-images(1).
func (*PodmanSession) OutputToString ¶
func (s *PodmanSession) OutputToString() string
OutputToString formats session output to string
func (*PodmanSession) OutputToStringArray ¶
func (s *PodmanSession) OutputToStringArray() []string
OutputToStringArray returns the output as a []string where each array item is a line split by newline
func (*PodmanSession) WaitWithDefaultTimeout ¶
func (s *PodmanSession) WaitWithDefaultTimeout()
WaitWithDefaultTimeout waits for process finished with defaultWaitTimeout
type PodmanTest ¶
type PodmanTest struct { PodmanMakeOptions func(args []string) []string PodmanBinary string ArtifactPath string TempDir string RemoteTest bool RemotePodmanBinary string VarlinkSession *os.Process VarlinkEndpoint string VarlinkCommand *exec.Cmd ImageCacheDir string ImageCacheFS string }
PodmanTest struct for command line options
func (*PodmanTest) GetContainerStatus ¶
func (p *PodmanTest) GetContainerStatus() string
GetContainerStatus returns the containers state. This function assumes only one container is active.
func (*PodmanTest) MakeOptions ¶
func (p *PodmanTest) MakeOptions(args []string) []string
MakeOptions assembles all podman options
func (*PodmanTest) NumberOfContainers ¶
func (p *PodmanTest) NumberOfContainers() int
NumberOfContainers returns an int of how many containers are currently defined.
func (*PodmanTest) NumberOfContainersRunning ¶
func (p *PodmanTest) NumberOfContainersRunning() int
NumberOfContainersRunning returns an int of how many containers are currently running.
func (*PodmanTest) NumberOfPods ¶
func (p *PodmanTest) NumberOfPods() int
NumberOfPods returns an int of how many pods are currently defined.
func (*PodmanTest) PodmanAsUserBase ¶
func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, cwd string, env []string, nocache bool) *PodmanSession
PodmanAsUserBase exec podman as user. uid and gid is set for credentials useage. env is used to record the env for debugging
func (*PodmanTest) PodmanBase ¶
func (p *PodmanTest) PodmanBase(args []string, nocache bool) *PodmanSession
PodmanBase exec podman with default env.
func (*PodmanTest) WaitContainerReady ¶
WaitContainerReady waits process or service inside container start, and ready to be used.
func (*PodmanTest) WaitForContainer ¶
func (p *PodmanTest) WaitForContainer() bool
WaitForContainer waits on a started container