util

package
v2.27.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CACertTempLocation string
View Source
var (
	CRCHome string
)
View Source
var (
	E2eLog *log.Logger
)
View Source
var TestDir string
View Source
var TestResultsDir string
View Source
var TestRunDir string

Functions

func CheckFormat

func CheckFormat(format string, actual string) error

func CleanTestRunDir

func CleanTestRunDir() error

func ClearScenarioVariables

func ClearScenarioVariables()

func CloseHostShellInstance

func CloseHostShellInstance() error

func CloseLog

func CloseLog() error

func CommandReturnShouldBeEmpty

func CommandReturnShouldBeEmpty(commandField string) error

func CommandReturnShouldContain

func CommandReturnShouldContain(commandField string, expected string) error

func CommandReturnShouldContainContent

func CommandReturnShouldContainContent(commandField string, expected *messages.PickleStepArgument_PickleDocString) error

func CommandReturnShouldEqual

func CommandReturnShouldEqual(commandField string, expected string) error

func CommandReturnShouldEqualContent

func CommandReturnShouldEqualContent(commandField string, expected *messages.PickleStepArgument_PickleDocString) error

func CommandReturnShouldMatch

func CommandReturnShouldMatch(commandField string, expected string) error

func CommandReturnShouldMatchContent

func CommandReturnShouldMatchContent(commandField string, expected *messages.PickleStepArgument_PickleDocString) error

func CommandReturnShouldNotBeEmpty

func CommandReturnShouldNotBeEmpty(commandField string) error

func CommandReturnShouldNotContain

func CommandReturnShouldNotContain(commandField string, notexpected string) error

func CommandReturnShouldNotContainContent

func CommandReturnShouldNotContainContent(commandField string, notexpected *messages.PickleStepArgument_PickleDocString) error

func CommandReturnShouldNotEqual

func CommandReturnShouldNotEqual(commandField string, expected string) error

func CommandReturnShouldNotEqualContent

func CommandReturnShouldNotEqualContent(commandField string, expected *messages.PickleStepArgument_PickleDocString) error

func CommandReturnShouldNotMatch

func CommandReturnShouldNotMatch(commandField string, expected string) error

func CommandReturnShouldNotMatchContent

func CommandReturnShouldNotMatchContent(commandField string, expected *messages.PickleStepArgument_PickleDocString) error

func CompareExpectedWithActualContains

func CompareExpectedWithActualContains(expected string, actual string) error

func CompareExpectedWithActualEquals

func CompareExpectedWithActualEquals(expected string, actual string) error

func CompareExpectedWithActualMatchesRegex

func CompareExpectedWithActualMatchesRegex(expected string, actual string) error

func CompareExpectedWithActualNotContains

func CompareExpectedWithActualNotContains(notexpected string, actual string) error

func CompareExpectedWithActualNotEquals

func CompareExpectedWithActualNotEquals(notexpected string, actual string) error

func CompareExpectedWithActualNotMatchesRegex

func CompareExpectedWithActualNotMatchesRegex(notexpected string, actual string) error

func ConfigFileContainsKey

func ConfigFileContainsKey(format string, configPath string, condition string, keyPath string) error

func ConfigFileContainsKeyMatchingValue

func ConfigFileContainsKeyMatchingValue(format string, configPath string, condition string, keyPath string, expectedValue string) error

func CopyFilesToTestDir

func CopyFilesToTestDir() error

func CopyResourcesFromPath

func CopyResourcesFromPath(resourcesPath string) error

func CreateDirectory

func CreateDirectory(dirName string) error

func CreateFile

func CreateFile(fileName string) error

func DeleteDirectory

func DeleteDirectory(dirName string) error

func DeleteFile

func DeleteFile(fileName string) error

func DirectoryShouldNotExist

func DirectoryShouldNotExist(dirName string) error

func DownloadBundle

func DownloadBundle(bundleLocation string, bundleDestination string, bundleName string) (string, error)

Download bundle for testing

func DownloadFileIntoLocation

func DownloadFileIntoLocation(downloadURL string, destinationFolder string) error

func ExecuteCommand

func ExecuteCommand(command string) error

func ExecuteCommandSucceedsOrFails

func ExecuteCommandSucceedsOrFails(command string, expectedResult string) error

func ExecuteCommandWithRetry

func ExecuteCommandWithRetry(retryCount int, retryTime string, command string, containsOrNot string, expected string) error

func ExecuteStdoutLineByLine

func ExecuteStdoutLineByLine() error

func FileContentIsInValidFormat

func FileContentIsInValidFormat(filePath string, format string) error

func FileContentShouldContain

func FileContentShouldContain(filePath string, expected string) error

func FileContentShouldEqual

func FileContentShouldEqual(filePath string, expected string) error

func FileContentShouldMatchRegex

func FileContentShouldMatchRegex(filePath string, expected string) error

func FileContentShouldNotContain

func FileContentShouldNotContain(filePath string, expected string) error

func FileContentShouldNotEqual

func FileContentShouldNotEqual(filePath string, expected string) error

func FileContentShouldNotMatchRegex

func FileContentShouldNotMatchRegex(filePath string, expected string) error

func FileExist

func FileExist(fileName string) error

func FileShouldNotExist

func FileShouldNotExist(fileName string) error

func GetBundlePath

func GetBundlePath(preset preset.Preset) string

GetBundlePath returns a path to the cached bundle, depending on the preset

func GetConfigKeyValue

func GetConfigKeyValue(configData []byte, format string, keyPath string) (string, error)

func GetFileContent

func GetFileContent(path string) (string, error)

func GetLastCommandOutput

func GetLastCommandOutput(commandField string) string

func LogMessage

func LogMessage(messageInfo, message string) error

func MatchRepetitionsWithRetry

func MatchRepetitionsWithRetry(expression string, match func(string) error, matchRepetitions int, iterations, timeoutInSeconds int) error

MatchRepetitionsWithRetry will execute match function with expression as arg for #iterations with a timeout, expression should be matched # matchRepetitions in a row

func MatchWithRetry

func MatchWithRetry(expression string, match func(string) error, iterations, timeoutInSeconds int) error

MatchWithRetry will execute match function with expression as arg for #iterations with a timeout

func PerformRegexMatch

func PerformRegexMatch(regex string, input string) (bool, error)

func PrepareForE2eTest

func PrepareForE2eTest() error

func PrepareTestResultsDir

func PrepareTestResultsDir() error

func PrepareTestRunDir

func PrepareTestRunDir() error

func ProcessScenarioVariables

func ProcessScenarioVariables(command string) string

func RemoveCRCHome

func RemoveCRCHome() error

func RunDiagnose

func RunDiagnose(dir string) error

func RunProxy

func RunProxy()

func SetScenarioVariable

func SetScenarioVariable(name string, value string)

func SetScenarioVariableExecutingCommand

func SetScenarioVariableExecutingCommand(variableName string, command string) error

func ShouldBeInValidFormat

func ShouldBeInValidFormat(commandField string, format string) error

func StartHostShellInstance

func StartHostShellInstance(shellName string) error

func StartLog

func StartLog(logPath string) error

func ValidateIP

func ValidateIP(inputString string) (bool, error)

func ValidateIPWithPort

func ValidateIPWithPort(inputString string) (bool, error)

func ValidateURL

func ValidateURL(inputString string) (bool, error)

func ValidateYAML

func ValidateYAML(inputString string) (bool, error)

func WriteTempFile

func WriteTempFile(content string, name string) (string, error)

WriteTempFile returns full path of the temp file it created, and an error

func WriteToFile

func WriteToFile(text string, fileName string) error

Types

type Collector

type Collector interface {
	Collect(Writer) error
}

type CommandCollector

type CommandCollector struct {
	Command, Target string
}

func (*CommandCollector) Collect

func (collector *CommandCollector) Collect(w Writer) error

type ContainerLogCollector

type ContainerLogCollector struct {
	Process string
}

func (*ContainerLogCollector) Collect

func (collector *ContainerLogCollector) Collect(w Writer) error

type FileCollector

type FileCollector struct {
	Source, Target string
}

func (*FileCollector) Collect

func (collector *FileCollector) Collect(w Writer) error

type FileWriter

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

func (*FileWriter) Write

func (fw *FileWriter) Write(filename string, bin []byte) error

type ShellInstance

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

func (*ShellInstance) Close

func (shell *ShellInstance) Close() error

func (*ShellInstance) ConfigureTypeOfShell

func (shell *ShellInstance) ConfigureTypeOfShell(shellName string)

func (*ShellInstance) GetLastCmdOutput

func (shell *ShellInstance) GetLastCmdOutput(stdType string) string

func (*ShellInstance) ScanPipe

func (shell *ShellInstance) ScanPipe(scanner *bufio.Scanner, buffer *bytes.Buffer, stdType string)

func (*ShellInstance) Start

func (shell *ShellInstance) Start(shellName string) error

type TreeCollector

type TreeCollector struct {
	Dir    string
	Target string
}

func (*TreeCollector) Collect

func (collector *TreeCollector) Collect(w Writer) error

type VMCommandCollector

type VMCommandCollector struct {
	Command, Target string
}

func (*VMCommandCollector) Collect

func (collector *VMCommandCollector) Collect(w Writer) error

type Writer

type Writer interface {
	Write(filename string, bin []byte) error
}

Jump to

Keyboard shortcuts

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