testhelpers

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertContains

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

func AssertContainsMatch added in v0.1.0

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

func AssertDirContainsFileWithContents

func AssertDirContainsFileWithContents(t *testing.T, dir string, file string, expected string)

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 AssertMatch

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

func AssertNil

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

func AssertNotContains added in v0.1.0

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

func AssertNotEq

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

func AssertNotNil

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

func AssertOnTarEntry added in v0.2.0

func AssertOnTarEntry(t *testing.T, tarFile, 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, value string)

func CreateImageOnLocal

func CreateImageOnLocal(t *testing.T, dockerCli *client.Client, repoName, dockerFile string)

func CreateImageOnRemote

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

func DockerRmi

func DockerRmi(dockerCli *client.Client, 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 NewFakeBuilderImage added in v0.2.0

func NewFakeBuilderImage(t *testing.T, name string, buildpacks []builder.BuildpackMetadata, config builder.Config) *fakes.Image

func PullImageWithAuth added in v0.1.0

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

func PushImage added in v0.1.0

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

func RandString

func RandString(n int) string

func RecursiveCopy added in v0.1.0

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

func RequireDocker added in v0.1.0

func RequireDocker(t *testing.T)

func Run

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

func RunContainer added in v0.2.0

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

func RunE

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

func UntarSingleFile added in v0.1.0

func UntarSingleFile(r io.Reader, fileName string) ([]byte, error)

Types

type FakeImageFetcher added in v0.2.0

type FakeImageFetcher struct {
	LocalImages  map[string]imgutil.Image
	RemoteImages map[string]imgutil.Image
	FetchCalls   map[string]*FetchArgs
}

func NewFakeImageFetcher added in v0.2.0

func NewFakeImageFetcher() *FakeImageFetcher

func (*FakeImageFetcher) Fetch added in v0.2.0

func (f *FakeImageFetcher) Fetch(ctx context.Context, name string, daemon, pull bool) (imgutil.Image, error)

type FakeLifecycle added in v0.2.0

type FakeLifecycle struct {
	Opts build.LifecycleOptions
}

func (*FakeLifecycle) Execute added in v0.2.0

func (f *FakeLifecycle) Execute(ctx context.Context, opts build.LifecycleOptions) error

type FetchArgs added in v0.2.0

type FetchArgs struct {
	Daemon bool
	Pull   bool
}

type TarEntryAssertion added in v0.2.0

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

func ContentEquals added in v0.2.0

func ContentEquals(expected string) TarEntryAssertion

func HasFileMode added in v0.2.0

func HasFileMode(expectedMode int64) TarEntryAssertion

func HasOwnerAndGroup added in v0.2.0

func HasOwnerAndGroup(expectedUID int, expectedGID int) TarEntryAssertion

func SymlinksTo added in v0.2.0

func SymlinksTo(expectedTarget string) TarEntryAssertion

type TestRegistryConfig added in v0.1.0

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

func RunRegistry

func RunRegistry(t *testing.T, seedRegistry bool) *TestRegistryConfig

func (*TestRegistryConfig) AuthConfig added in v0.2.0

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

func (*TestRegistryConfig) Login added in v0.2.0

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

func (*TestRegistryConfig) RegistryAuth added in v0.1.0

func (rc *TestRegistryConfig) RegistryAuth() string

func (*TestRegistryConfig) RegistryCatalog added in v0.1.0

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

func (*TestRegistryConfig) RepoName added in v0.1.0

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

func (*TestRegistryConfig) StopRegistry added in v0.1.0

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

Jump to

Keyboard shortcuts

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