Documentation ¶
Index ¶
- func AssertBlobsLen(t *testing.T, path string, expected int)
- func AssertBuildpacksHaveDescriptors(t *testing.T, modules []buildpack.BuildModule, ...)
- func AssertContains(t *testing.T, actual, expected string)
- func AssertContainsAllInOrder(t *testing.T, actual bytes.Buffer, expected ...string)
- func AssertContainsMatch(t *testing.T, actual, exp string)
- func AssertEq(t *testing.T, actual, expected interface{}, opts ...cmp.Option)
- func AssertError(t *testing.T, actual error, expected string)
- func AssertFalse(t *testing.T, actual interface{})
- func AssertFunctionName(t *testing.T, fn interface{}, expected string)
- func AssertGitHeadEq(t *testing.T, path1, path2 string)
- func AssertIncludeAllExpectedPatterns(t *testing.T, receivedArgs []string, expectedPatterns ...[]string)
- func AssertMapContains[key comparable, value any](t *testing.T, actual map[key]value, expected ...KeyValue[key, value])
- func AssertMapNotContains[key comparable, value any](t *testing.T, actual map[key]value, expected ...KeyValue[key, value])
- func AssertMatch(t *testing.T, actual string, expected string)
- func AssertNil(t *testing.T, actual interface{})
- func AssertNilE(t *testing.T, actual interface{})
- func AssertNotContains(t *testing.T, actual, expected string)
- func AssertNotContainsMatch(t *testing.T, actual, exp string)
- func AssertNotEq(t *testing.T, actual, expected interface{})
- func AssertNotNil(t *testing.T, actual interface{})
- func AssertOnTarEntries(t *testing.T, tarPath string, entryPath1, entryPath2 string, ...)
- func AssertOnTarEntry(t *testing.T, tarPath, entryPath string, assertFns ...TarEntryAssertion)
- func AssertPathDoesNotExists(t *testing.T, path string)
- func AssertPathExists(t *testing.T, path string)
- func AssertRemoteImageIndex(t *testing.T, repoName string, mediaType types.MediaType, ...)
- func AssertSameInstance(t *testing.T, actual, expected interface{})
- func AssertSliceContains(t *testing.T, slice []string, expected ...string)
- func AssertSliceContainsInOrder(t *testing.T, slice []string, expected ...string)
- func AssertSliceContainsMatch(t *testing.T, slice []string, expected ...string)
- func AssertSliceContainsOnly(t *testing.T, slice []string, expected ...string)
- func AssertSliceNotContains(t *testing.T, slice []string, expected ...string)
- func AssertTarFileContents(t *testing.T, tarfile, path, expected string)
- func AssertTarHasFile(t *testing.T, tarFile, path string)
- func AssertTarball(t *testing.T, path string)
- func AssertTrue(t *testing.T, actual interface{})
- func AssertUnique(t *testing.T, items ...interface{})
- func CheckImageBuildResult(response dockertypes.ImageBuildResponse, err error) error
- func CopyFile(t *testing.T, src, dst string)
- func CopyFileE(src, dst string) error
- func CreateImage(t *testing.T, dockerCli client.CommonAPIClient, repoName, dockerFile string)
- func CreateImageFromDir(t *testing.T, dockerCli client.CommonAPIClient, repoName string, dir string)
- func CreateImageOnRemote(t *testing.T, dockerCli client.CommonAPIClient, ...) string
- func CreateRegistryFixture(t *testing.T, tmpDir, fixturePath string) string
- func CreateRemoteImage(t *testing.T, repoName, tag, baseImage string) *imgutilRemote.Image
- func CreateTAR(t *testing.T, srcDir, tarDir string, mode int64) string
- func CreateTGZ(t *testing.T, srcDir, tarDir string, mode int64) string
- func Digest(t *testing.T, repoName string) string
- func DockerHostname(t *testing.T) string
- func DockerRmi(dockerCli client.CommonAPIClient, repoNames ...string) error
- func Eventually(t *testing.T, test func() bool, every time.Duration, timeout time.Duration)
- func FetchImageIndexDescriptor(t *testing.T, repoName string) v1.ImageIndex
- func HTTPGetE(url string, headers map[string]string) (string, error)
- func ImageID(t *testing.T, repoName string) string
- func LayerFileName(bp buildpack.BuildModule) string
- func MockWriterAndOutput() (*color.Console, func() string)
- func NewRandomIndexRepoName() string
- func PullImageWithAuth(dockerCli client.CommonAPIClient, ref, registryAuth string) error
- func PushImage(dockerCli client.CommonAPIClient, ref string, ...) error
- func RandString(n int) string
- func RandomCNBIndex(t *testing.T, repoName string, layers, count int64) *imgutil.CNBIndex
- func RandomCNBIndexAndDigest(t *testing.T, repoName string, layers, count int64) (idx imgutil.ImageIndex, digest name.Digest)
- func ReadIndexManifest(t *testing.T, path string) *v1.IndexManifest
- func RecursiveCopy(t *testing.T, src, dst string)
- func RecursiveCopyE(src, dst string) error
- func RecursiveCopyNow(t *testing.T, src, dst string)
- func RegistryHost(host, port string) string
- func RequireDocker(t *testing.T)
- func Run(t *testing.T, cmd *exec.Cmd) string
- func RunContainer(ctx context.Context, dockerCli client.CommonAPIClient, id string, ...) error
- func RunE(cmd *exec.Cmd) (string, error)
- func SkipIf(t *testing.T, expression bool, reason string)
- func SkipUnless(t *testing.T, expression bool, reason string)
- func TopLayerDiffID(t *testing.T, repoName string) string
- type AssertionManager
- func (a AssertionManager) AssertTrimmedContains(actual, expected string)
- func (a AssertionManager) Contains(actual, expected string)
- func (a AssertionManager) ContainsAll(actual string, expected ...string)
- func (a AssertionManager) ContainsF(actual, expected string, formatArgs ...interface{})
- func (a AssertionManager) ContainsJSON(actualJSON, expectedJSON string)
- func (a AssertionManager) ContainsTOML(actualTOML, expectedTOML string)
- func (a AssertionManager) ContainsWithMessage(actual, expected, messageFormat string)
- func (a AssertionManager) ContainsYAML(actualYAML, expectedYAML string)
- func (a AssertionManager) Equal(actual, expected interface{})
- func (a AssertionManager) EqualJSON(actualJSON, expectedJSON string)
- func (a AssertionManager) EqualTOML(actualTOML, expectedTOML string)
- func (a AssertionManager) EqualYAML(actualYAML, expectedYAML string)
- func (a AssertionManager) Error(actual error)
- func (a AssertionManager) ErrorContains(actual error, expected string)
- func (a AssertionManager) ErrorWithMessage(actual error, message string)
- func (a AssertionManager) ErrorWithMessageF(actual error, format string, args ...interface{})
- func (a AssertionManager) Fails(actual interface{})
- func (a *AssertionManager) FileExists(filePath string)
- func (a *AssertionManager) FileIsNotEmpty(filePath string)
- func (a AssertionManager) Matches(actual string, pattern *regexp.Regexp)
- func (a AssertionManager) MatchesAll(actual string, patterns ...*regexp.Regexp)
- func (a AssertionManager) Nil(actual interface{})
- func (a AssertionManager) NilWithMessage(actual interface{}, message string)
- func (a AssertionManager) NoMatches(actual string, pattern *regexp.Regexp)
- func (a AssertionManager) NotContainWithMessage(actual, expected, messageFormat string)
- func (a AssertionManager) NotContains(actual, expected string)
- func (a AssertionManager) NotEqual(actual, expected interface{})
- func (a AssertionManager) NotNil(actual interface{})
- func (a AssertionManager) Succeeds(actual interface{})
- func (a AssertionManager) TrimmedEq(actual, expected string)
- func (a AssertionManager) TrueWithMessage(actual bool, message string)
- type FakeAddedLayerImage
- type FakeWithRandomUnderlyingImage
- type KeyValue
- type MockImageIndex
- type TarEntriesAssertion
- type TarEntryAssertion
- func AssertOnNestedTar(nestedEntryPath string, assertions ...TarEntryAssertion) TarEntryAssertion
- func ContentContains(expected string) TarEntryAssertion
- func ContentEquals(expected string) TarEntryAssertion
- func DoesNotHaveModTime(expectedTime time.Time) TarEntryAssertion
- func HasFileMode(expectedMode int64) TarEntryAssertion
- func HasModTime(expectedTime time.Time) TarEntryAssertion
- func HasOwnerAndGroup(expectedUID int, expectedGID int) TarEntryAssertion
- func IsDirectory() TarEntryAssertion
- func IsGzipped() TarEntryAssertion
- func IsJSON() TarEntryAssertion
- func SymlinksTo(expectedTarget string) TarEntryAssertion
- type TarVerifier
- type TestRegistryConfig
- func (rc *TestRegistryConfig) AuthConfig() dockerregistry.AuthConfig
- func (rc *TestRegistryConfig) Login(t *testing.T, username string, password string)
- func (rc *TestRegistryConfig) RegistryAuth() string
- func (rc *TestRegistryConfig) RegistryCatalog() (string, error)
- func (rc *TestRegistryConfig) RepoName(name string) string
- func (rc *TestRegistryConfig) RmRegistry(t *testing.T)
- func (rc *TestRegistryConfig) StopRegistry(t *testing.T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertBuildpacksHaveDescriptors ¶ added in v0.12.0
func AssertBuildpacksHaveDescriptors(t *testing.T, modules []buildpack.BuildModule, descriptors []dist.BuildpackDescriptor)
func AssertContains ¶
func AssertContainsAllInOrder ¶ added in v0.12.0
func AssertContainsMatch ¶
AssertContainsMatch matches on content by regular expression
func AssertFalse ¶
func AssertFunctionName ¶ added in v0.12.0
func AssertGitHeadEq ¶ added in v0.12.0
func AssertIncludeAllExpectedPatterns ¶ added in v0.10.0
func AssertMapContains ¶ added in v0.32.0
func AssertMapContains[key comparable, value any](t *testing.T, actual map[key]value, expected ...KeyValue[key, value])
func AssertMapNotContains ¶ added in v0.32.0
func AssertMapNotContains[key comparable, value any](t *testing.T, actual map[key]value, expected ...KeyValue[key, value])
func AssertNil ¶
AssertNil checks for nil value, if not nil it fails the test and stops execution immediately.
func AssertNilE ¶ added in v0.19.0
AssertNilE checks for nil value, if not nil it sets test as failed without stopping execution.
func AssertNotContains ¶
func AssertNotContainsMatch ¶
func AssertNotEq ¶ added in v0.12.0
Assert deep equality (and provide useful difference as a test failure)
func AssertNotNil ¶
func AssertOnTarEntries ¶ added in v0.33.0
func AssertOnTarEntries(t *testing.T, tarPath string, entryPath1, entryPath2 string, assertFns ...TarEntriesAssertion)
func AssertOnTarEntry ¶
func AssertOnTarEntry(t *testing.T, tarPath, entryPath string, assertFns ...TarEntryAssertion)
func AssertPathDoesNotExists ¶ added in v0.34.0
func AssertPathExists ¶ added in v0.34.0
func AssertRemoteImageIndex ¶ added in v0.34.0
func AssertSameInstance ¶
Assert the simplistic pointer (or literal value) equality
func AssertSliceContains ¶
func AssertSliceContainsInOrder ¶ added in v0.12.0
func AssertSliceContainsMatch ¶ added in v0.10.0
func AssertSliceContainsOnly ¶
func AssertSliceNotContains ¶ added in v0.11.0
func AssertTarFileContents ¶ added in v0.12.0
func AssertTarHasFile ¶ added in v0.12.0
func AssertTarball ¶ added in v0.10.0
func AssertTrue ¶
func AssertUnique ¶
func CheckImageBuildResult ¶ added in v0.23.0
func CheckImageBuildResult(response dockertypes.ImageBuildResponse, err error) error
func CreateImage ¶
func CreateImage(t *testing.T, dockerCli client.CommonAPIClient, repoName, dockerFile string)
func CreateImageFromDir ¶
func CreateImageOnRemote ¶
func CreateImageOnRemote(t *testing.T, dockerCli client.CommonAPIClient, registryConfig *TestRegistryConfig, repoName, dockerFile string) string
func CreateRegistryFixture ¶ added in v0.12.0
func CreateRemoteImage ¶ added in v0.34.0
func CreateRemoteImage(t *testing.T, repoName, tag, baseImage string) *imgutilRemote.Image
func DockerHostname ¶ added in v0.13.0
func Eventually ¶
func FetchImageIndexDescriptor ¶ added in v0.34.0
func FetchImageIndexDescriptor(t *testing.T, repoName string) v1.ImageIndex
func LayerFileName ¶ added in v0.29.0
func LayerFileName(bp buildpack.BuildModule) string
func MockWriterAndOutput ¶ added in v0.12.0
func NewRandomIndexRepoName ¶ added in v0.34.0
func NewRandomIndexRepoName() 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 RandomCNBIndex ¶ added in v0.34.0
func RandomCNBIndexAndDigest ¶ added in v0.34.0
func ReadIndexManifest ¶ added in v0.34.0
func ReadIndexManifest(t *testing.T, path string) *v1.IndexManifest
func RecursiveCopy ¶
func RecursiveCopyE ¶ added in v0.14.0
func RecursiveCopyNow ¶ added in v0.11.0
func RegistryHost ¶ added in v0.13.0
func RequireDocker ¶
func RunContainer ¶
Types ¶
type AssertionManager ¶ added in v0.13.0
type AssertionManager struct {
// contains filtered or unexported fields
}
func NewAssertionManager ¶ added in v0.13.0
func NewAssertionManager(testObject *testing.T) AssertionManager
func (AssertionManager) AssertTrimmedContains ¶ added in v0.13.0
func (a AssertionManager) AssertTrimmedContains(actual, expected string)
func (AssertionManager) Contains ¶ added in v0.13.0
func (a AssertionManager) Contains(actual, expected string)
func (AssertionManager) ContainsAll ¶ added in v0.13.0
func (a AssertionManager) ContainsAll(actual string, expected ...string)
func (AssertionManager) ContainsF ¶ added in v0.13.0
func (a AssertionManager) ContainsF(actual, expected string, formatArgs ...interface{})
func (AssertionManager) ContainsJSON ¶ added in v0.15.0
func (a AssertionManager) ContainsJSON(actualJSON, expectedJSON string)
func (AssertionManager) ContainsTOML ¶ added in v0.15.0
func (a AssertionManager) ContainsTOML(actualTOML, expectedTOML string)
func (AssertionManager) ContainsWithMessage ¶ added in v0.13.0
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 ¶ added in v0.15.0
func (a AssertionManager) ContainsYAML(actualYAML, expectedYAML string)
func (AssertionManager) Equal ¶ added in v0.13.0
func (a AssertionManager) Equal(actual, expected interface{})
func (AssertionManager) EqualJSON ¶ added in v0.16.0
func (a AssertionManager) EqualJSON(actualJSON, expectedJSON string)
func (AssertionManager) EqualTOML ¶ added in v0.16.0
func (a AssertionManager) EqualTOML(actualTOML, expectedTOML string)
func (AssertionManager) EqualYAML ¶ added in v0.16.0
func (a AssertionManager) EqualYAML(actualYAML, expectedYAML string)
func (AssertionManager) Error ¶ added in v0.13.0
func (a AssertionManager) Error(actual error)
Error checks that the provided value is an error (non-nil)
func (AssertionManager) ErrorContains ¶ added in v0.14.0
func (a AssertionManager) ErrorContains(actual error, expected string)
func (AssertionManager) ErrorWithMessage ¶ added in v0.15.0
func (a AssertionManager) ErrorWithMessage(actual error, message string)
func (AssertionManager) ErrorWithMessageF ¶ added in v0.15.0
func (a AssertionManager) ErrorWithMessageF(actual error, format string, args ...interface{})
func (AssertionManager) Fails ¶ added in v0.14.0
func (a AssertionManager) Fails(actual interface{})
func (*AssertionManager) FileExists ¶ added in v0.16.0
func (a *AssertionManager) FileExists(filePath string)
func (*AssertionManager) FileIsNotEmpty ¶ added in v0.16.0
func (a *AssertionManager) FileIsNotEmpty(filePath string)
func (AssertionManager) Matches ¶ added in v0.13.0
func (a AssertionManager) Matches(actual string, pattern *regexp.Regexp)
func (AssertionManager) MatchesAll ¶ added in v0.13.0
func (a AssertionManager) MatchesAll(actual string, patterns ...*regexp.Regexp)
func (AssertionManager) Nil ¶ added in v0.13.0
func (a AssertionManager) Nil(actual interface{})
func (AssertionManager) NilWithMessage ¶ added in v0.13.0
func (a AssertionManager) NilWithMessage(actual interface{}, message string)
func (AssertionManager) NoMatches ¶ added in v0.13.0
func (a AssertionManager) NoMatches(actual string, pattern *regexp.Regexp)
func (AssertionManager) NotContainWithMessage ¶ added in v0.13.0
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 ¶ added in v0.14.0
func (a AssertionManager) NotContains(actual, expected string)
func (AssertionManager) NotEqual ¶ added in v0.14.0
func (a AssertionManager) NotEqual(actual, expected interface{})
func (AssertionManager) NotNil ¶ added in v0.13.0
func (a AssertionManager) NotNil(actual interface{})
func (AssertionManager) Succeeds ¶ added in v0.14.0
func (a AssertionManager) Succeeds(actual interface{})
func (AssertionManager) TrimmedEq ¶ added in v0.13.0
func (a AssertionManager) TrimmedEq(actual, expected string)
func (AssertionManager) TrueWithMessage ¶ added in v0.15.0
func (a AssertionManager) TrueWithMessage(actual bool, message string)
type FakeAddedLayerImage ¶ added in v0.29.0
func (*FakeAddedLayerImage) AddLayerWithDiffID ¶ added in v0.29.0
func (f *FakeAddedLayerImage) AddLayerWithDiffID(path, diffID string) error
func (*FakeAddedLayerImage) AddedLayersOrder ¶ added in v0.29.0
func (f *FakeAddedLayerImage) AddedLayersOrder() []string
type FakeWithRandomUnderlyingImage ¶ added in v0.34.0
type FakeWithRandomUnderlyingImage struct { *fakes.Image // contains filtered or unexported fields }
func NewFakeWithRandomUnderlyingV1Image ¶ added in v0.34.0
func NewFakeWithRandomUnderlyingV1Image(t *testing.T, repoName string, identifier imgutil.Identifier) *FakeWithRandomUnderlyingImage
func (*FakeWithRandomUnderlyingImage) GetLayer ¶ added in v0.34.0
func (t *FakeWithRandomUnderlyingImage) GetLayer(sha string) (io.ReadCloser, error)
func (*FakeWithRandomUnderlyingImage) UnderlyingImage ¶ added in v0.34.0
func (t *FakeWithRandomUnderlyingImage) UnderlyingImage() v1.Image
type KeyValue ¶ added in v0.32.0
type KeyValue[k comparable, v any] struct { // contains filtered or unexported fields }
func NewKeyValue ¶ added in v0.32.0
func NewKeyValue[k comparable, v any](key k, value v) KeyValue[k, v]
type MockImageIndex ¶ added in v0.34.0
type MockImageIndex struct { imgutil.CNBIndex ErrorOnSave bool PushCalled bool PurgeOption bool DeleteDirCalled bool }
MockImageIndex wraps a real CNBIndex to record if some key methods are invoke
func NewMockImageIndex ¶ added in v0.34.0
func NewMockImageIndex(t *testing.T, repoName string, layers, count int64) *MockImageIndex
NewMockImageIndex creates a random index with the given number of layers and manifests count
func (*MockImageIndex) DeleteDir ¶ added in v0.34.0
func (i *MockImageIndex) DeleteDir() error
func (*MockImageIndex) Push ¶ added in v0.34.0
func (i *MockImageIndex) Push(ops ...imgutil.IndexOption) error
func (*MockImageIndex) SaveDir ¶ added in v0.34.0
func (i *MockImageIndex) SaveDir() error
type TarEntriesAssertion ¶ added in v0.33.0
type TarEntriesAssertion func(t *testing.T, header1 *tar.Header, data1 []byte, header2 *tar.Header, data2 []byte)
func AreEquivalentHardLinks ¶ added in v0.33.0
func AreEquivalentHardLinks() TarEntriesAssertion
type TarEntryAssertion ¶
func AssertOnNestedTar ¶ added in v0.10.0
func AssertOnNestedTar(nestedEntryPath string, assertions ...TarEntryAssertion) TarEntryAssertion
func ContentContains ¶ added in v0.10.0
func ContentContains(expected string) TarEntryAssertion
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 IsGzipped ¶ added in v0.10.0
func IsGzipped() TarEntryAssertion
func IsJSON ¶ added in v0.10.0
func IsJSON() TarEntryAssertion
func SymlinksTo ¶
func SymlinksTo(expectedTarget string) TarEntryAssertion
type TarVerifier ¶ added in v0.12.0
type TarVerifier struct {
// contains filtered or unexported fields
}
func NewTarVerifier ¶ added in v0.12.0
func (*TarVerifier) NextDirectory ¶ added in v0.12.0
func (v *TarVerifier) NextDirectory(name string, mode int64)
func (*TarVerifier) NextFile ¶ added in v0.12.0
func (v *TarVerifier) NextFile(name, expectedFileContents string, expectedFileMode int64)
func (*TarVerifier) NextSymLink ¶ added in v0.12.0
func (v *TarVerifier) NextSymLink(name, link string)
func (*TarVerifier) NoMoreFilesExist ¶ added in v0.12.0
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() dockerregistry.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) RmRegistry ¶ added in v0.18.0
func (rc *TestRegistryConfig) RmRegistry(t *testing.T)
func (*TestRegistryConfig) StopRegistry ¶
func (rc *TestRegistryConfig) StopRegistry(t *testing.T)