Documentation
¶
Index ¶
- Constants
- Variables
- func AssertErrorPattern(t *testing.T, pattern string, err error)
- func AssertSameDependencies(t *testing.T, expectedList []build.ImageDependencies, ...)
- func AssertSameEnv(t *testing.T, expected, actual []build.EnvVar)
- func DependenciesWithDigests(original build.ImageDependencies) *build.ImageDependencies
- func GetDigest(image string) string
- func GetRepoDigests(image string) string
- func HelloNodeExampleDependenciesOn(registry string) build.ImageDependencies
- func ImageReferenceWithDigest(original *build.ImageReference) *build.ImageReference
- func MultistageExampleDependenciesOn(registry string) build.ImageDependencies
- func NewImageDependencies(image string, runtime string, buildtimes []string) *build.ImageDependencies
- func ReportOnError(t *testing.T, f func() error)
- func StartStaticFileServer(t *testing.T, handler http.Handler) *http.Server
- func StreamArchiveFromDir(t *testing.T, root string, w io.Writer) error
- type FixedResponseHandler
- type MappedStringGenerator
- type StaticArchiveHandler
- type StaticContentHandler
- type StringGenerator
- type TestConfig
Constants ¶
const DotnetExampleFullImageName = DotnetExampleTargetRegistryName + "/" + DotnetExampleTargetImageName
DotnetExampleFullImageName is the image name for dotnet example
const DotnetExampleTargetImageName = "img"
DotnetExampleTargetImageName is a placeholder image name
const DotnetExampleTargetRegistryName = "registry"
DotnetExampleTargetRegistryName is a placeholder registry name
const StaticFileHost = "http://localhost" + staticFilePort
StaticFileHost is where the file server is
const TestsDockerRegistryName = "unit-tests/"
TestsDockerRegistryName is the registry name used for testing
Variables ¶
var DotnetExampleDependencies = *NewImageDependencies( DotnetExampleFullImageName, "microsoft/aspnetcore:2.0.6", []string{"microsoft/aspnetcore-build:2.0", "imaginary/cert-generator:1.0"}, )
DotnetExampleDependencies links to the project in ${workspaceRoot}/tests/resources/docker-dotnet
var DotnetExampleMinimalBuildArg = []string{"build_image=aspnetcore-build"}
DotnetExampleMinimalBuildArg is the minimal build arg required for dotnet example
var EmptyContext = build.NewContext([]build.EnvVar{}, []build.EnvVar{})
EmptyContext is an empty build context
var ExpectedACRBuilderRelativePaths = []string{
"Dockerfile",
"CONTRIBUTING.md",
"Makefile",
"main.go",
"README.md",
"VERSION",
"LICENSE",
}
var ExpectedMultiStageExampleRelativePaths = []string{
"Dockerfile",
"program.go",
}
var HelloNodeExampleDependencies = HelloNodeExampleDependenciesOn(TestsDockerRegistryName)
HelloNodeExampleDependencies returns dependencies to the project in ${workspaceRoot}/tests/resources/hello-node
var MultiStageExampleRoot string
MultiStageExampleRoot is the multistage example's root
var MultistageExampleDependencies = MultistageExampleDependenciesOn(TestsDockerRegistryName)
MultistageExampleDependencies returns dependencies to the project in ${workspaceRoot}/tests/resources/hello-multistage with default docker registry name
var NilError error
NilError is a placeholder for mock objects to use when mocking a function that returns an error
Functions ¶
func AssertErrorPattern ¶ added in v0.5.0
func AssertSameDependencies ¶
func AssertSameDependencies(t *testing.T, expectedList []build.ImageDependencies, actualList []build.ImageDependencies)
AssertSameDependencies help determine two sets of dependencies are equivalent
func AssertSameEnv ¶
AssertSameEnv asserts two sets environment variable are the same
func DependenciesWithDigests ¶
func DependenciesWithDigests(original build.ImageDependencies) *build.ImageDependencies
DependenciesWithDigests populates mock digest values for image dependencies
func GetRepoDigests ¶
GetRepoDigests gets the mock RepoDigests of a image
func HelloNodeExampleDependenciesOn ¶
func HelloNodeExampleDependenciesOn(registry string) build.ImageDependencies
HelloNodeExampleDependenciesOn returns dependencies to the project in ${workspaceRoot}/tests/resources/hello-node
func ImageReferenceWithDigest ¶
func ImageReferenceWithDigest(original *build.ImageReference) *build.ImageReference
ImageReferenceWithDigest populates mock digest values for image
func MultistageExampleDependenciesOn ¶
func MultistageExampleDependenciesOn(registry string) build.ImageDependencies
MultistageExampleDependenciesOn returns dependencies to the project in ${workspaceRoot}/tests/resources/hello-multistage
func NewImageDependencies ¶
func NewImageDependencies(image string, runtime string, buildtimes []string) *build.ImageDependencies
NewImageDependencies creates a image dependency object
func ReportOnError ¶
ReportOnError Reports an error when function fails
func StartStaticFileServer ¶
StartStaticFileServer starts a file server, if error returned is not null the caller should close it
Types ¶
type FixedResponseHandler ¶ added in v0.5.0
FixedResponseHandler serves a fix response
func (*FixedResponseHandler) ServeHTTP ¶ added in v0.5.0
func (h *FixedResponseHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type MappedStringGenerator ¶
type MappedStringGenerator struct { StringGenerator // contains filtered or unexported fields }
MappedStringGenerator geneate unique strings and allow lookup for string that was generated
func NewMappedGenerator ¶
func NewMappedGenerator(prefix string) *MappedStringGenerator
NewMappedGenerator generates a unique string and can be looked up later by the given key value
func (*MappedStringGenerator) Lookup ¶
func (g *MappedStringGenerator) Lookup(key string) string
Lookup the unique string generated
func (*MappedStringGenerator) NextWithKey ¶
func (g *MappedStringGenerator) NextWithKey(key string) string
NextWithKey generates a unique string and can be looked up later by the given key value
type StaticArchiveHandler ¶
StaticArchiveHandler streams the hello-multistage project to http response as tar.gz We hard code the archive file for now, because we only have 1 test scenario using it
func (*StaticArchiveHandler) ServeHTTP ¶
func (h *StaticArchiveHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves content of a directory
type StaticContentHandler ¶
StaticContentHandler serves a fixed string
func (*StaticContentHandler) ServeHTTP ¶
func (h *StaticContentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves the static contents
type StringGenerator ¶
type StringGenerator struct { Prefix string // contains filtered or unexported fields }
StringGenerator generate unique string with given prefix
type TestConfig ¶
type TestConfig struct {
ProjectRoot string
}
TestConfig is the configuration used for unit tests
var Config TestConfig
Config is the instance of test config object loaded form default locations