testhelpers

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertBuildpacksHaveDescriptors

func AssertBuildpacksHaveDescriptors(t *testing.T, bps []dist.Buildpack, descriptors []dist.BuildpackDescriptor)

func AssertContains

func AssertContains(t *testing.T, actual, expected string)

func AssertContainsAllInOrder

func AssertContainsAllInOrder(t *testing.T, actual bytes.Buffer, expected ...string)

func AssertContainsMatch

func AssertContainsMatch(t *testing.T, actual, exp string)

AssertContainsMatch matches on content by regular expression

func AssertEq

func AssertEq(t *testing.T, actual, expected interface{})

Assert deep equality (and provide useful difference as a test failure)

func AssertError

func AssertError(t *testing.T, actual error, expected string)

func AssertFalse

func AssertFalse(t *testing.T, actual interface{})

func AssertFunctionName

func AssertFunctionName(t *testing.T, fn interface{}, expected string)

func AssertGitHeadEq

func AssertGitHeadEq(t *testing.T, path1, path2 string)

func AssertIncludeAllExpectedPatterns

func AssertIncludeAllExpectedPatterns(t *testing.T, receivedArgs []string, expectedPatterns ...[]string)

func AssertMatch

func AssertMatch(t *testing.T, actual string, expected string)

func AssertNil

func AssertNil(t *testing.T, actual interface{})

func AssertNotContains

func AssertNotContains(t *testing.T, actual, expected string)

func AssertNotContainsMatch

func AssertNotContainsMatch(t *testing.T, actual, exp string)

func AssertNotEq

func AssertNotEq(t *testing.T, actual, expected interface{})

Assert deep equality (and provide useful difference as a test failure)

func AssertNotNil

func AssertNotNil(t *testing.T, actual interface{})

func AssertOnTarEntry

func AssertOnTarEntry(t *testing.T, tarPath, entryPath string, assertFns ...TarEntryAssertion)

func AssertSameInstance

func AssertSameInstance(t *testing.T, actual, expected interface{})

Assert the simplistic pointer (or literal value) equality

func AssertSliceContains

func AssertSliceContains(t *testing.T, slice []string, expected ...string)

func AssertSliceContainsInOrder

func AssertSliceContainsInOrder(t *testing.T, slice []string, expected ...string)

func AssertSliceContainsMatch

func AssertSliceContainsMatch(t *testing.T, slice []string, expected ...string)

func AssertSliceContainsOnly

func AssertSliceContainsOnly(t *testing.T, slice []string, expected ...string)

func AssertSliceNotContains

func AssertSliceNotContains(t *testing.T, slice []string, expected ...string)

func AssertTarFileContents

func AssertTarFileContents(t *testing.T, tarfile, path, expected string)

func AssertTarHasFile

func AssertTarHasFile(t *testing.T, tarFile, path string)

func AssertTarball

func AssertTarball(t *testing.T, path string)

func AssertTrue

func AssertTrue(t *testing.T, actual interface{})

func AssertUnique

func AssertUnique(t *testing.T, items ...interface{})

func CopyFile

func CopyFile(t *testing.T, src, dst string)

func CopyFileE

func CopyFileE(src, dst string) error

func CreateImage

func CreateImage(t *testing.T, dockerCli client.CommonAPIClient, repoName, dockerFile string)

func CreateImageFromDir

func CreateImageFromDir(t *testing.T, dockerCli client.CommonAPIClient, repoName string, dir string)

func CreateImageOnRemote

func CreateImageOnRemote(t *testing.T, dockerCli client.CommonAPIClient, registryConfig *TestRegistryConfig, repoName, dockerFile string) string

func CreateRegistryFixture

func CreateRegistryFixture(t *testing.T, tmpDir, fixturePath string) string

func CreateTAR

func CreateTAR(t *testing.T, srcDir, tarDir string, mode int64) string

func CreateTGZ

func CreateTGZ(t *testing.T, srcDir, tarDir string, mode int64) string

func Digest

func Digest(t *testing.T, repoName string) string

func DockerHostname

func DockerHostname(t *testing.T) string

func DockerRmi

func DockerRmi(dockerCli client.CommonAPIClient, repoNames ...string) error

func Eventually

func Eventually(t *testing.T, test func() bool, every time.Duration, timeout time.Duration)

func HTTPGetE

func HTTPGetE(url string, headers map[string]string) (string, error)

func ImageID

func ImageID(t *testing.T, repoName string) string

func MockWriterAndOutput

func MockWriterAndOutput() (*color.Console, func() string)

func PullImageWithAuth

func PullImageWithAuth(dockerCli client.CommonAPIClient, ref, registryAuth string) error

func PushImage

func PushImage(dockerCli client.CommonAPIClient, ref string, registryConfig *TestRegistryConfig) error

func RandString

func RandString(n int) string

func ReadPackConfig added in v0.15.2

func ReadPackConfig(t *testing.T) config.Config

func RecursiveCopy

func RecursiveCopy(t *testing.T, src, dst string)

func RecursiveCopyE

func RecursiveCopyE(src, dst string) error

func RecursiveCopyNow

func RecursiveCopyNow(t *testing.T, src, dst string)

func RegistryHost

func RegistryHost(host, port string) string

func RequireDocker

func RequireDocker(t *testing.T)

func Run

func Run(t *testing.T, cmd *exec.Cmd) string

func RunContainer

func RunContainer(ctx context.Context, dockerCli client.CommonAPIClient, id string, stdout io.Writer, stderr io.Writer) error

func RunE

func RunE(cmd *exec.Cmd) (string, error)

func SkipIf

func SkipIf(t *testing.T, expression bool, reason string)

func SkipUnless

func SkipUnless(t *testing.T, expression bool, reason string)

func TopLayerDiffID

func TopLayerDiffID(t *testing.T, repoName string) string

Types

type AssertionManager

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

func NewAssertionManager

func NewAssertionManager(testObject *testing.T) AssertionManager

func (AssertionManager) AssertTrimmedContains

func (a AssertionManager) AssertTrimmedContains(actual, expected string)

func (AssertionManager) Contains

func (a AssertionManager) Contains(actual, expected string)

func (AssertionManager) ContainsAll

func (a AssertionManager) ContainsAll(actual string, expected ...string)

func (AssertionManager) ContainsF

func (a AssertionManager) ContainsF(actual, expected string, formatArgs ...interface{})

func (AssertionManager) ContainsJSON

func (a AssertionManager) ContainsJSON(actualJSON, expectedJSON string)

func (AssertionManager) ContainsTOML

func (a AssertionManager) ContainsTOML(actualTOML, expectedTOML string)

func (AssertionManager) ContainsWithMessage

func (a AssertionManager) ContainsWithMessage(actual, expected, messageFormat string)

ContainsWithMessage will fail if expected is not contained within actual, messageFormat will be printed as the failure message, with actual interpolated in the message

func (AssertionManager) ContainsYAML

func (a AssertionManager) ContainsYAML(actualYAML, expectedYAML string)

func (AssertionManager) Equal

func (a AssertionManager) Equal(actual, expected interface{})

func (AssertionManager) Error

func (a AssertionManager) Error(actual error)

Error checks that the provided value is an error (non-nil)

func (AssertionManager) ErrorContains

func (a AssertionManager) ErrorContains(actual error, expected string)

func (AssertionManager) ErrorWithMessage

func (a AssertionManager) ErrorWithMessage(actual error, message string)

func (AssertionManager) ErrorWithMessageF

func (a AssertionManager) ErrorWithMessageF(actual error, format string, args ...interface{})

func (AssertionManager) Fails

func (a AssertionManager) Fails(actual interface{})

func (AssertionManager) Matches

func (a AssertionManager) Matches(actual string, pattern *regexp.Regexp)

func (AssertionManager) MatchesAll

func (a AssertionManager) MatchesAll(actual string, patterns ...*regexp.Regexp)

func (AssertionManager) Nil

func (a AssertionManager) Nil(actual interface{})

func (AssertionManager) NilWithMessage

func (a AssertionManager) NilWithMessage(actual interface{}, message string)

func (AssertionManager) NoMatches

func (a AssertionManager) NoMatches(actual string, pattern *regexp.Regexp)

func (AssertionManager) NotContainWithMessage

func (a AssertionManager) NotContainWithMessage(actual, expected, messageFormat string)

NotContainWithMessage will fail if expected is contained within actual, messageFormat will be printed as the failure message, with actual interpolated in the message

func (AssertionManager) NotContains

func (a AssertionManager) NotContains(actual, expected string)

func (AssertionManager) NotEqual

func (a AssertionManager) NotEqual(actual, expected interface{})

func (AssertionManager) NotNil

func (a AssertionManager) NotNil(actual interface{})

func (AssertionManager) Succeeds

func (a AssertionManager) Succeeds(actual interface{})

func (AssertionManager) TrimmedEq

func (a AssertionManager) TrimmedEq(actual, expected string)

func (AssertionManager) TrueWithMessage

func (a AssertionManager) TrueWithMessage(actual bool, message string)

type TarEntryAssertion

type TarEntryAssertion func(t *testing.T, header *tar.Header, data []byte)

func AssertOnNestedTar

func AssertOnNestedTar(nestedEntryPath string, assertions ...TarEntryAssertion) TarEntryAssertion

func ContentContains

func ContentContains(expected string) TarEntryAssertion

func ContentEquals

func ContentEquals(expected string) TarEntryAssertion

func DoesNotHaveModTime

func DoesNotHaveModTime(expectedTime time.Time) TarEntryAssertion

func HasFileMode

func HasFileMode(expectedMode int64) TarEntryAssertion

func HasModTime

func HasModTime(expectedTime time.Time) TarEntryAssertion

func HasOwnerAndGroup

func HasOwnerAndGroup(expectedUID int, expectedGID int) TarEntryAssertion

func IsDirectory

func IsDirectory() TarEntryAssertion

func IsGzipped

func IsGzipped() TarEntryAssertion

func IsJSON

func IsJSON() TarEntryAssertion

func SymlinksTo

func SymlinksTo(expectedTarget string) TarEntryAssertion

type TarVerifier

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

func NewTarVerifier

func NewTarVerifier(t *testing.T, tr *tar.Reader, uid, gid int) *TarVerifier

func (*TarVerifier) NextDirectory

func (v *TarVerifier) NextDirectory(name string, mode int64)

func (*TarVerifier) NextFile

func (v *TarVerifier) NextFile(name, expectedFileContents string, expectedFileMode int64)
func (v *TarVerifier) NextSymLink(name, link string)

func (*TarVerifier) NoMoreFilesExist

func (v *TarVerifier) NoMoreFilesExist()

type TestRegistryConfig

type TestRegistryConfig struct {
	RunRegistryHost string
	RunRegistryPort string
	DockerConfigDir string
	// contains filtered or unexported fields
}

func RunRegistry

func RunRegistry(t *testing.T) *TestRegistryConfig

func (*TestRegistryConfig) AuthConfig

func (rc *TestRegistryConfig) AuthConfig() dockertypes.AuthConfig

func (*TestRegistryConfig) Login

func (rc *TestRegistryConfig) Login(t *testing.T, username string, password string)

func (*TestRegistryConfig) RegistryAuth

func (rc *TestRegistryConfig) RegistryAuth() string

func (*TestRegistryConfig) RegistryCatalog

func (rc *TestRegistryConfig) RegistryCatalog() (string, error)

func (*TestRegistryConfig) RepoName

func (rc *TestRegistryConfig) RepoName(name string) string

func (*TestRegistryConfig) StopRegistry

func (rc *TestRegistryConfig) StopRegistry(t *testing.T)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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