utils

package
v0.0.0-...-b69053b Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package utils contains e2e tests utils for cli tools e2e tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CLITestSuite

func CLITestSuite(ctx context.Context, tswg *sync.WaitGroup, testSuites chan *junitxml.TestSuite,
	logger *log.Logger, testSuiteRegex, testCaseRegex *regexp.Regexp,
	testProjectConfig *testconfig.Project, testSuiteName string, testsMap map[CLITestType]map[*junitxml.TestCase]func(
		context.Context, *junitxml.TestCase, *log.Logger, *testconfig.Project, CLITestType))

CLITestSuite executes given test suite.

func ContainsSubString

func ContainsSubString(strs []string, s string) bool

ContainsSubString checks whether the string slice contains a substring anywhere.

func Failure

func Failure(testCase *junitxml.TestCase, logger *log.Logger, msg string)

Failure logs failure message to both test case output and logger.

func GcloudAuth

func GcloudAuth(logger *log.Logger, testCase *junitxml.TestCase) bool

GcloudAuth runs "gcloud auth"

func GcloudUpdate

func GcloudUpdate(logger *log.Logger, testCase *junitxml.TestCase, latest bool) bool

GcloudUpdate runs "gcloud update" to pull either latest or prod version

func RunCliTool

func RunCliTool(logger *log.Logger, testCase *junitxml.TestCase, cmdString string, args []string) error

RunCliTool runs a cli tool with given args

func RunTestCommand

func RunTestCommand(cmd string, args []string, logger *log.Logger, testCase *junitxml.TestCase) bool

RunTestCommand runs given test command

func RunTestCommandAsync

func RunTestCommandAsync(cmd string, args []string, logger *log.Logger, testCase *junitxml.TestCase) *exec.Cmd

RunTestCommandAsync runs given test command asynchronously

func RunTestCommandIgnoringError

func RunTestCommandIgnoringError(cmd string, args []string, logger *log.Logger, testCase *junitxml.TestCase) bool

RunTestCommandIgnoringError runs given test command. The test case won't be marked as fail even error happens.

func RunTestForTestType

func RunTestForTestType(cmd string, args []string, testType CLITestType, logger *log.Logger, testCase *junitxml.TestCase) bool

RunTestForTestType runs test for given test type

Types

type CLITestType

type CLITestType string

CLITestType defines which type of test is going to be executed

const (
	Wrapper                       CLITestType = "1 wrapper"
	GcloudBetaProdWrapperLatest   CLITestType = "2 gcloud(beta)-prod wrapper-latest"
	GcloudBetaLatestWrapperLatest CLITestType = "3 gcloud(beta)-latest wrapper-latest"
	GcloudGaLatestWrapperRelease  CLITestType = "4 gcloud(ga)-latest wrapper-release"
)

List all test types here

Jump to

Keyboard shortcuts

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