jx: github.com/jenkins-x/jx/pkg/tests Index | Files

package tests

import "github.com/jenkins-x/jx/pkg/tests"


Package Files

console_wrapper.go files.go helpers.go retry.go

func AssertDirContentsEqual Uses

func AssertDirContentsEqual(t *testing.T, expectedDir string, actualDir string)

AssertDirContentsEqual walks two directory structures and validates that the same files exist (by name) and that they have the same content

func AssertDirDoesNotExist Uses

func AssertDirDoesNotExist(t *testing.T, dir string) bool

AssertDirDoesNotExist asserts that the given directory does not exist

func AssertDirExists Uses

func AssertDirExists(t *testing.T, dir string) bool

AssertDirExists asserts that the given directory exists

func AssertDirsExist Uses

func AssertDirsExist(t *testing.T, expected bool, paths ...string)

AssertDirsExist asserts that the list of directory paths either exist or don't exist

func AssertEqualFileText Uses

func AssertEqualFileText(t *testing.T, expectedFile string, actualFile string) error

func AssertFileContains Uses

func AssertFileContains(t *testing.T, fileName string, containsText string)

AssertFileContains asserts that a given file exists and contains the given text

func AssertFileDoesNotContain Uses

func AssertFileDoesNotContain(t *testing.T, fileName string, containsText string)

AssertFileDoesNotContain asserts that a given file exists and does not contain the given text

func AssertFileDoesNotExist Uses

func AssertFileDoesNotExist(t *testing.T, fileName string) bool

AssertFileDoesNotExist asserts that the given file does not exist

func AssertFileExists Uses

func AssertFileExists(t *testing.T, fileName string) bool

AssertFileExists asserts that the given file exists

func AssertFilesExist Uses

func AssertFilesExist(t *testing.T, expected bool, paths ...string)

AssertFilesExist asserts that the list of file paths either exist or don't exist

func AssertLoadFileText Uses

func AssertLoadFileText(t *testing.T, fileName string) (string, error)

AssertLoadFileText asserts that the given file name can be loaded and returns the string contents

func AssertTextFileContentsEqual Uses

func AssertTextFileContentsEqual(t *testing.T, expectedFile string, actualFile string)

AssertTextFileContentsEqual asserts that both the expected and actual files can be loaded as text and that their contents are identical

func CreateAuthConfigService Uses

func CreateAuthConfigService() auth.ConfigService

CreateAuthConfigService creates and returns a fixture ConfigService

func Debugf Uses

func Debugf(message string, args ...interface{})

Debugf debug format

func ExpectString Uses

func ExpectString(t *testing.T, console *expect.Console, s string)

ExpectString does the same as the go-expect console.ExpectString method, but also reports failures to the testing object in a sensible format

func IsDebugLog Uses

func IsDebugLog() bool

IsDebugLog debug log?

func Output Uses

func Output() terminal.FileWriter

Output returns the output to use for tests

func Retry Uses

func Retry(t *testing.T, maxAttempts int, sleep time.Duration, f func(r *R)) bool

Retry runs function f for up to maxAttempts times until f returns successfully, and reports whether f was run successfully. It will sleep for the given period between invocations of f. Use the provided *tests.R instead of a *testing.T from the function.

func SkipForWindows Uses

func SkipForWindows(t *testing.T, reason string)

SkipForWindows skips tests if they are running on Windows This is to be used for valid tests that just don't work on windows for whatever reason

func TestCloser Uses

func TestCloser(t *testing.T, closer io.Closer)

TestCloser closes io

func TestShouldDisableMaven Uses

func TestShouldDisableMaven() bool

TestShouldDisableMaven should disable maven

type ConsoleWrapper Uses

type ConsoleWrapper struct {
    // contains filtered or unexported fields

ConsoleWrapper is a wrapper around the go-expect Console that takes a test object and will report failures This prevents users having to manually detect and report errors during the tests

func NewTerminal Uses

func NewTerminal(t assert.TestingT, timeout *time.Duration) *ConsoleWrapper

NewTerminal mock terminal to control stdin and stdout

func (*ConsoleWrapper) Cleanup Uses

func (c *ConsoleWrapper) Cleanup()

Cleanup closes all resources the console was using

func (*ConsoleWrapper) Close Uses

func (c *ConsoleWrapper) Close()

Close closes the console input

func (*ConsoleWrapper) CurrentState Uses

func (c *ConsoleWrapper) CurrentState() string

CurrentState gets the last line of text currently on the console

func (*ConsoleWrapper) ExpectEOF Uses

func (c *ConsoleWrapper) ExpectEOF()

ExpectEOF expects an EOF to be present on the console and reports an error if it is not

func (*ConsoleWrapper) ExpectString Uses

func (c *ConsoleWrapper) ExpectString(s string)

ExpectString expects a string to be present on the console and fails the test if it is not

func (*ConsoleWrapper) SendLine Uses

func (c *ConsoleWrapper) SendLine(s string)

SendLine sends a string to the console and fails the test if something goes wrong

type R Uses

type R struct {
    // The number of current attempt.
    Attempt int
    // contains filtered or unexported fields

R is passed to each run of a flaky test run, manages state and accumulates log statements.

func (*R) Errorf Uses

func (r *R) Errorf(s string, v ...interface{})

Errorf is equivalent to Logf followed by Fail.

func (*R) Fail Uses

func (r *R) Fail()

Fail marks the run as failed, and will retry once the function returns.

func (*R) Logf Uses

func (r *R) Logf(s string, v ...interface{})

Logf formats its arguments and records it in the error log. The text is only printed for the final unsuccessful run or the first successful run.

Package tests imports 25 packages (graph) and is imported by 1 packages. Updated 2020-05-24. Refresh now. Tools for package owners.