utils

package
v1.1.1-0...-9418116 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalyzePods

func AnalyzePods(client kubectl.Client, namespace string, cachedLogger logger.Logger) error

AnalyzePods waits for the pods to be running (if possible) and healthcheck them

func Capture

func Capture() func() (string, error)

Capture replaces os.Stdout with a writer that buffers any data written to os.Stdout. Call the returned function to cleanup and get the data as a string.

func ChangeWorkingDir

func ChangeWorkingDir(pwd string, cachedLogger logger.Logger) error

ChangeWorkingDir changes the working directory

func Copy

func Copy(src, dest string) error

Copy copies src to dest, doesn't matter if src is a directory or a file

func CreateTempDir

func CreateTempDir() (dirPath string, dirName string, err error)

CreateTempDir creates a temp directory in /tmp

func DeleteNamespace

func DeleteNamespace(client kubectl.Client, namespace string)

DeleteNamespace deletes a given namespace and waits for the process to finish

func DeleteTempAndResetWorkingDir

func DeleteTempAndResetWorkingDir(tmpDir string, pwd string, log logger.Logger)

DeleteTempAndResetWorkingDir deletes /tmp dir and reinitialize the working dir

func DeleteTempDir

func DeleteTempDir(dirPath string, log logger.Logger)

DeleteTempDir deletes temp directory

func Equal

func Equal(a, b []string) bool

Equal tells whether a and b contain the same elements.

func GenerateNamespaceName

func GenerateNamespaceName(prefix string) string

GenerateNamespaceName generates a new Namespace name with the given prefix and a random suffix

func LookForDeployment

func LookForDeployment(client kubectl.Client, namespace string, expectedDeployment ...string) (bool, error)

LookForDeployment search for a specific deployment name among the deployments, returns true if found

func PortForwardAndPing

func PortForwardAndPing(config *latest.Config, generatedConfig *generated.Config, client kubectl.Client, cachedLogger logger.Logger) error

PortForwardAndPing creates port-forwardings and ping them for a 200 status code

func PrintTestResult

func PrintTestResult(testName string, subTestName string, err error, log logger.Logger)

PrintTestResult prints a test result with a specific formatting

func PurgeNamespacesByPrefixes

func PurgeNamespacesByPrefixes(nsPrefixes []string) error

PurgeNamespacesByPrefixes deletes the namespaces that were created during testing process

func SpaceExists

func SpaceExists(str string, list []*latestSpace.Space) bool

SpaceExists checks if a string is in a slice

func StringInSlice

func StringInSlice(str string, list []string) bool

StringInSlice checks if a string is in a slice

Types

type BaseCustomFactory

type BaseCustomFactory struct {
	*factory.DefaultFactoryImpl

	CacheLogger logger.Logger
	Buff        *bytes.Buffer
	Verbose     bool
	Timeout     int
	Namespace   string
	Pwd         string
	Client      kubectl.Client
	DirPath     string
	DirName     string
}

BaseCustomFactory is a factory override for testing

func (*BaseCustomFactory) GetLog

func (b *BaseCustomFactory) GetLog() logger.Logger

GetLog implements interface

func (*BaseCustomFactory) GetLogContents

func (b *BaseCustomFactory) GetLogContents() string

func (*BaseCustomFactory) ResetLog

func (b *BaseCustomFactory) ResetLog()

ResetLog resets the log

Jump to

Keyboard shortcuts

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