helper

package
v1.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chdir

func Chdir(dir string)

Chdir change current working dir

func CmdRunner

func CmdRunner(program string, args ...string) *gexec.Session

func CmdShouldFail

func CmdShouldFail(program string, args ...string) string

CmdShouldFail returns stderr if command fails

func CmdShouldPass

func CmdShouldPass(program string, args ...string) string

CmdShouldPass returns stdout if command succeeds

func CopyExample

func CopyExample(exampleName string, targetDir string)

CopyExample copies an example from tests/e2e/examples/<exampleName> into targetDir

func CreateFileWithContent

func CreateFileWithContent(path string, fileContent string) error

CreateFileWithContent creates a file at the given path and writes the given content path is the path to the required file fileContent is the content to be written to the given file

func CreateNewContext

func CreateNewContext() string

CreateNewContext create new empty temporary directory

func CreateRandProject

func CreateRandProject() string

CreateRandProject create new project with random name (10 letters) without writing to the config file (without switching project)

func DeleteDir

func DeleteDir(dir string)

DeleteDir delete directory

func DeleteProject

func DeleteProject(projectName string)

DeleteProject deletes a specified project

func DetermineRouteURL

func DetermineRouteURL() string

DetermineRouteURL returns the http URL where the current component exposes it's service this URL can then be used in order to interact with the deployed service running in Openshift

func FileShouldContainSubstring

func FileShouldContainSubstring(file string, subString string)

FileShouldContainSubstring check if file contains subString

func GetConfigValue

func GetConfigValue(key string) string

GetConfigValue returns a local config value of given key or returns an empty string if value is not set

func GetConfigValueWithContext

func GetConfigValueWithContext(key string, context string) string

GetConfigValueWithContext returns a local config value of given key and contextdir or returns an empty string if value is not set

func GetPreferenceValue

func GetPreferenceValue(key string) string

GetPreferenceValue a global config value of given key or returns an empty string if value is not set

func Getwd

func Getwd() string

Getwd retruns current working dir

func HttpWaitFor

func HttpWaitFor(url string, match string, maxRetry int, interval int)

HttpWaitFor periodically (every interval) calls GET to given url ends when result response contains match string, or after the maxRetry

func RandString

func RandString(n int) string

RandString returns a random string of given length

func WaitForCmdOut

func WaitForCmdOut(program string, args []string, timeout int, errOnFail bool, check func(output string) bool) bool

WaitForCmdOut runs a command until it gets the expected output. It accepts 5 arguments, program (program to be run) args (arguments to the program) timeout (the time to wait for the output) errOnFail (flag to set if test should fail if command fails) check (function with output check logic) It times out if the command doesn't fetch the expected output within the timeout period.

Types

type OcRunner

type OcRunner struct {
	// contains filtered or unexported fields
}

func NewOcRunner

func NewOcRunner(ocPath string) OcRunner

NewOcRunner initializes new OcRunner

func (*OcRunner) CheckCmdOpInRemoteCmpPod

func (oc *OcRunner) CheckCmdOpInRemoteCmpPod(cmpName string, appName string, prjName string, cmd []string, checkOp func(cmdOp string, err error) bool) bool

CheckCmdOpInRemoteCmpPod runs the provided command on remote component pod and returns the return value of command output handler function passed to it

func (*OcRunner) EnvVarTest

func (oc *OcRunner) EnvVarTest(resourceName string, sourceType string, envString string)

EnvVarTest checks the component container env vars in the build config for git and deployment config for git/binary/local appTestName is the app of the app sourceType is the type of the source of the component i.e git/binary/local

func (*OcRunner) ExecListDir

func (oc *OcRunner) ExecListDir(podName string, projectName string) string

ExecListDir returns dir list in specified location of pod

func (*OcRunner) GetComponentDC

func (oc *OcRunner) GetComponentDC(component string, app string, project string) string

GetComponentDC run command to get the DeploymentConfig in yaml format for given component

func (*OcRunner) GetComponentRoutes

func (oc *OcRunner) GetComponentRoutes(component string, app string, project string) string

GetComponentRoutes run command to get the Routes in yaml format for given component

func (*OcRunner) GetCurrentProject

func (oc *OcRunner) GetCurrentProject() string

GetCurrentProject get currently active project in oc returns empty string if there no active project, or no access to the project

func (*OcRunner) GetDcName

func (oc *OcRunner) GetDcName(compName string, namespace string) string

GetDcName execute oc command and returns dc name of a delopyed component by passing component name as a argument

func (*OcRunner) GetFirstURL

func (oc *OcRunner) GetFirstURL(component string, app string, project string) string

GetFirstURL returns the url of the first Route that it can find for given component

func (*OcRunner) GetLoginUser

func (oc *OcRunner) GetLoginUser() string

GetLoginUser returns current user name

func (*OcRunner) GetRoute

func (oc *OcRunner) GetRoute(urlName string, appName string) string

GetRoute returns route URL

func (*OcRunner) GetRunningPodNameOfComp

func (oc *OcRunner) GetRunningPodNameOfComp(compName string, namespace string) string

GetRunningPodNameOfComp executes oc command and returns the running pod name of a delopyed component by passing component name as a argument

func (*OcRunner) GetToken

func (oc *OcRunner) GetToken() string

GetToken returns current user token

func (*OcRunner) GetVolumeMountName

func (oc *OcRunner) GetVolumeMountName(dcName string) string

GetVolumeMountName returns the name of the volume

func (*OcRunner) GetVolumeMountPath

func (oc *OcRunner) GetVolumeMountPath(dcName string) string

GetVolumeMountPath returns the path of the volume mount

func (*OcRunner) ImportJavaIsToNspace

func (oc *OcRunner) ImportJavaIsToNspace(project string)

ImportJavaIsToNspace import the openjdk image which is used for jars

func (*OcRunner) LoginUsingToken

func (oc *OcRunner) LoginUsingToken(token string) string

LoginUsingToken returns output after successful login

func (*OcRunner) MaxCPU

func (oc *OcRunner) MaxCPU(componentName string, appName string, project string) string

MaxCPU reuturns maximum cpu

func (*OcRunner) MaxMemory

func (oc *OcRunner) MaxMemory(componentName string, appName string, project string) string

MaxMemory reuturns maximum memory

func (*OcRunner) MinCPU

func (oc *OcRunner) MinCPU(componentName string, appName string, project string) string

MinCPU reuturns maximum cpu

func (*OcRunner) MinMemory

func (oc *OcRunner) MinMemory(componentName string, appName string, project string) string

MinMemory reuturns minimum memory

func (*OcRunner) Run

func (oc *OcRunner) Run(cmd string) *gexec.Session

Run oc with given arguments

func (*OcRunner) ServiceInstanceStatus

func (oc *OcRunner) ServiceInstanceStatus(serviceInstanceName string) string

ServiceInstanceStatus returns service instance

func (*OcRunner) SourceTest

func (oc *OcRunner) SourceTest(appTestName string, sourceType string, source string)

SourceTest checks the component-source-type and the source url in the annotation of the bc and dc appTestName is the name of the app sourceType is the type of the source of the component i.e git/binary/local source is the source of the component i.e gitURL or path to the directory or binary file

func (*OcRunner) SwitchProject

func (oc *OcRunner) SwitchProject(projectName string)

SwitchProject switch to the project

func (*OcRunner) VerifyAppNameOfComponent

func (oc *OcRunner) VerifyAppNameOfComponent(cmpName string, appName string, namespace string)

VerifyAppNameOfComponent verifies app name of component

func (*OcRunner) VerifyCmpExists

func (oc *OcRunner) VerifyCmpExists(cmpName string, appName string, prjName string)

VerifyCmpExists verifies if component was created successfully

func (*OcRunner) VerifyCmpName

func (oc *OcRunner) VerifyCmpName(cmpName string, namespace string)

VerifyCmpName verifies the component name

Jump to

Keyboard shortcuts

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