testhelpers

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 35 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

func AssertContainsMatch(t *testing.T, actual, exp 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 AssertFalse

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

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 AssertNotNil

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

func AssertOnTarEntry

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, expected ...string)

func AssertSliceContainsOnly

func AssertSliceContainsOnly(t *testing.T, slice []string, expected ...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 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 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 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 GetFreePort

func GetFreePort() (string, error)

func HTTPGetE

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

func ImageID

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

func ListTarContents

func ListTarContents(tarPath string) ([]tar.Header, error)

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 RecursiveCopy

func RecursiveCopy(t *testing.T, src, dst 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 TopLayerDiffID

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

Types

type TarEntryAssertion

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

func ContentEquals

func ContentEquals(expected string) TarEntryAssertion

func DoesNotHaveModTime added in v0.9.0

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 SymlinksTo

func SymlinksTo(expectedTarget string) TarEntryAssertion

type TestRegistryConfig

type TestRegistryConfig struct {
	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)

Jump to

Keyboard shortcuts

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