test

package
v1.91.23 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeASymlink(target string) types.GomegaMatcher

BeASymlink asserts that a file is a symlink and the link points to a given target.

func CopyDirectory added in v1.67.0

func CopyDirectory(t *testing.T, source string, destination string)

CopyDirectory copies source to destination recursively.

func CopyFile added in v1.28.0

func CopyFile(t *testing.T, source string, destination string)

CopyFile copies source to destination. Before writing, it creates all required parent directories for the destination.

func CopySymlink(t *testing.T, source string, destination string)

CopySymlink copies source to destination. Before writing, it creates all required parent directories for the destination.

func HaveAppendBuildEnvironment added in v1.28.0

func HaveAppendBuildEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveAppendBuildEnvironment tests that a layer has an append build environment variable with the expected content.

func HaveAppendLaunchEnvironment added in v1.28.0

func HaveAppendLaunchEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveAppendLaunchEnvironment tests that a layer has an append launch environment variable with the expected content.

func HaveAppendPathBuildEnvironment deprecated added in v1.28.0

func HaveAppendPathBuildEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveAppendPathBuildEnvironment tests that a layer has an append path build environment variable with the expected content.

Deprecated: Use HavePrependPathBuildEnvironment

func HaveAppendPathLaunchEnvironment deprecated added in v1.28.0

func HaveAppendPathLaunchEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveAppendPathLaunchEnvironment tests that a layer has an append path launch environment variable with the expected content.

Deprecated: Use HavePrependPathLaunchEnvironment

func HaveAppendPathSharedEnvironment deprecated added in v1.28.0

func HaveAppendPathSharedEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveAppendPathSharedEnvironment tests that a layer has an append path shared environment variable with the expected content.

Deprecated: Use HavePrependPathSharedEnvironment

func HaveAppendSharedEnvironment added in v1.28.0

func HaveAppendSharedEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveAppendSharedEnvironment tests that a layer has an append shared environment variable with the expected content.

func HaveApplicationMetadata added in v1.45.0

func HaveApplicationMetadata(expected layers.Metadata) types.GomegaMatcher

HaveApplicationMetadata tests that an application metadata has expected content.

func HaveArchiveEntry added in v1.79.0

func HaveArchiveEntry(expected string) types.GomegaMatcher

HaveContent tests that a file has expected content.

func HaveContent added in v1.28.0

func HaveContent(expected string) types.GomegaMatcher

HaveContent tests that a file has expected content.

func HaveDefaultBuildEnvironment added in v1.89.4

func HaveDefaultBuildEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveDefaultBuildEnvironment tests that a layer has a default build environment variable with the expected content.

func HaveDefaultLaunchEnvironment added in v1.89.4

func HaveDefaultLaunchEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveDefaultLaunchEnvironment tests that a layer has a default launch environment variable with the expected content.

func HaveDefaultSharedEnvironment added in v1.89.4

func HaveDefaultSharedEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveDefaultSharedEnvironment tests that a layer has a default shared environment variable with the expected content.

func HaveDelimiterBuildEnvironment added in v1.89.4

func HaveDelimiterBuildEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveDelimiterBuildEnvironment tests that a layer has a delimiter for a build environment variable with the expected content.

func HaveDelimiterLaunchEnvironment added in v1.89.4

func HaveDelimiterLaunchEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveDelimiterLaunchEnvironment tests that a layer has a delimiter for a launch environment variable with the expected content.

func HaveDelimiterSharedEnvironment added in v1.89.4

func HaveDelimiterSharedEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveDelimiterSharedEnvironment tests that a layer has a delimiter for a shared environment variable with the expected content.

func HaveLayerMetadata added in v1.28.0

func HaveLayerMetadata(build bool, cache bool, launch bool) types.GomegaMatcher

HaveLayerMetadata tests that a layer has a specific metadata configuration.

func HaveLayerVersion added in v1.48.0

func HaveLayerVersion(version string) types.GomegaMatcher

HaveLayerVersion tests that a layer has a specific version.

func HaveOverrideBuildEnvironment added in v1.28.0

func HaveOverrideBuildEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveOverrideBuildEnvironment tests that a layer has an override build environment variable with the expected content.

func HaveOverrideLaunchEnvironment added in v1.28.0

func HaveOverrideLaunchEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveOverrideLaunchEnvironment tests that a layer has an override launch environment variable with the expected content.

func HaveOverrideSharedEnvironment added in v1.28.0

func HaveOverrideSharedEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HaveOverrideSharedEnvironment tests that a layer has an override shared environment variable with the expected content.

func HavePermissions added in v1.28.0

func HavePermissions(expected os.FileMode) types.GomegaMatcher

func HavePersistentMetadata added in v1.45.0

func HavePersistentMetadata(expected interface{}) types.GomegaMatcher

HavePersistentMetadata tests that an persistent metadata has expected content.

func HavePlans added in v1.82.0

func HavePlans(plans ...buildplan.Plan) types.GomegaMatcher

HavePlans tests that a set of plans is returned from detect.

func HavePrependBuildEnvironment added in v1.89.4

func HavePrependBuildEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HavePrependBuildEnvironment tests that a layer has a prepend build environment variable with the expected content.

func HavePrependLaunchEnvironment added in v1.89.4

func HavePrependLaunchEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HavePrependLaunchEnvironment tests that a layer has a prepend launch environment variable with the expected content.

func HavePrependPathBuildEnvironment added in v1.89.4

func HavePrependPathBuildEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HavePrependPathBuildEnvironment tests that a layer has a prepend path build environment variable with the expected content.

func HavePrependPathLaunchEnvironment added in v1.89.4

func HavePrependPathLaunchEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HavePrependPathLaunchEnvironment tests that a layer has a prepend path launch environment variable with the expected content.

func HavePrependPathSharedEnvironment added in v1.89.4

func HavePrependPathSharedEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HavePrependPathSharedEnvironment tests that a layer has a prepend path shared environment variable with the expected content.

func HavePrependSharedEnvironment added in v1.89.4

func HavePrependSharedEnvironment(name string, format string, args ...interface{}) types.GomegaMatcher

HavePrependSharedEnvironment tests that a layer has a prepend shared environment variable with the expected content.

func HaveProfile added in v1.28.0

func HaveProfile(name string, format string, args ...interface{}) types.GomegaMatcher

HaveProfile tests that a layer has a profile.d file with the expected content.

func ReplaceEnv added in v1.28.0

func ReplaceEnv(t *testing.T, key string, value string) func()

ReplaceEnv replaces an environment variable. Returns a function for use with defer in order to reset the previous value.

defer ReplaceEnv(t, "alpha", "bravo")()

func ScratchDir added in v1.32.0

func ScratchDir(t *testing.T, prefix string) string

ScratchDir returns a safe scratch directory for tests to modify.

func TouchFile added in v1.16.0

func TouchFile(t *testing.T, elem ...string)

TouchFile writes a zero-length file during testing.

func WriteFile added in v1.28.0

func WriteFile(t *testing.T, filename string, format string, args ...interface{})

WriteFile writes a file during testing.

func WriteFileFromReader added in v1.28.0

func WriteFileFromReader(t *testing.T, filename string, perm os.FileMode, source io.Reader)

WriteFileFromReader writes a file with the given content from a io.Reader. Before writing, it creates all required parent directories for the file.

func WriteFileWithPerm added in v1.31.0

func WriteFileWithPerm(t *testing.T, filename string, perm os.FileMode, format string, args ...interface{})

WriteFileWithPerm writes a file with specific permissions during testing.

func WriteSymlink(t *testing.T, oldName string, newName string)

WriteSymlink creates newName as a symbolic link to oldName. Before writing, it creates all required parent directories for the newName.

Types

type BuildFactory

type BuildFactory struct {
	// Build is the configured build to use.
	Build build.Build

	// Home is the home directory to use.
	Home string

	// Plans is the buildpack plans at termination.
	Plans buildpackplan.Plans

	// Runner is the used to capture commands executed outside the process.
	Runner *Runner
	// contains filtered or unexported fields
}

BuildFactory is a factory for creating a test Build.

func NewBuildFactory

func NewBuildFactory(t *testing.T) *BuildFactory

NewBuildFactory creates a new instance of BuildFactory.

func (*BuildFactory) AddDependency

func (f *BuildFactory) AddDependency(id string, fixturePath string)

AddDependency adds a dependency with version 1.0 to the buildpack metadata and copies a fixture into a cached dependency layer.

func (*BuildFactory) AddDependencyWithDependency added in v1.54.0

func (f *BuildFactory) AddDependencyWithDependency(dependency buildpack.Dependency, fixturePath string)

AddDependencyWithVersion adds a dependency to the buildpack metadata and copies a fixture into a cached dependency layer

func (*BuildFactory) AddDependencyWithVersion added in v1.28.0

func (f *BuildFactory) AddDependencyWithVersion(id string, version string, fixturePath string)

AddDependencyWithVersion adds a dependency to the buildpack metadata and copies a fixture into a cached dependency layer

func (*BuildFactory) AddPlan added in v1.81.0

func (f *BuildFactory) AddPlan(plan buildpackplan.Plan)

AddPlan adds a plan to the Plans.

func (*BuildFactory) AddService added in v1.38.0

func (f *BuildFactory) AddService(name string, credentials services.Credentials, tags ...string)

AddService adds an entry to the collection of services.

func (*BuildFactory) SetDefaultVersion added in v1.48.0

func (f *BuildFactory) SetDefaultVersion(id, version string)

SetDefaultVersion sets a default dependency version in the buildpack metadata

type Command added in v1.47.0

type Command struct {
	Bin  string
	Dir  string
	Args []string
}

type DetectFactory

type DetectFactory struct {
	// Detect is the configured detect to use.
	Detect detect.Detect

	// Home is the home directory to use.
	Home string

	// Plans is the build plans at termination.
	Plans buildplan.Plans

	// Runner is the used to capture commands executed outside the process.
	Runner *Runner
	// contains filtered or unexported fields
}

DetectFactory is a factory for creating a test Detect.

func NewDetectFactory

func NewDetectFactory(t *testing.T) *DetectFactory

NewDetectFactory creates a new instance of DetectFactory.

func (*DetectFactory) AddService added in v1.38.0

func (f *DetectFactory) AddService(name string, credentials services.Credentials, tags ...string)

AddService adds an entry to the collection of services.

type Runner added in v1.47.0

type Runner struct {
	Commands []Command
	Outputs  []string
}

Runner is an implementation of helper.Runner that collects commands and returns output

func (*Runner) Run added in v1.47.0

func (r *Runner) Run(bin string, dir string, args ...string) error

Run makes Runner satisfy the helper.Runner interface. This implementation collects the input.

func (*Runner) RunWithOutput added in v1.47.0

func (r *Runner) RunWithOutput(bin string, dir string, args ...string) ([]byte, error)

RunWithOutput makes Runner satisfy the helper.Runner interface. This implementation collects the input and return configured output.

Jump to

Keyboard shortcuts

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