test

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RuntimeApplicationLoc specifies the default runtime application locator
	RuntimeApplicationLoc = loc.MustParseLocator("gravitational.io/kubernetes:0.0.1")
	// RuntimePackageLoc specifies the default runtime package locator
	RuntimePackageLoc = loc.MustParseLocator("gravitational.io/planet:0.0.1")
)

Functions

func ApplicationLayout

func ApplicationLayout(app App, c *check.C) []*archive.Item

ApplicationLayout builds a list of items to place into an application package

func Chart

func Chart(locator loc.Locator) *chart.Chart

Chart returns chart object corresponding to the test chart defined below.

func CreateApplication

func CreateApplication(req AppRequest, c *check.C) (app *app.Application)

CreateApplication creates a new test application as described by the given request

func CreateApplicationFromData

func CreateApplicationFromData(apps app.Applications, locator loc.Locator, files []*archive.Item, c *check.C) *app.Application

CreateApplicationFromData creates a new test application in the given application service from the specified files

func CreateHelmChartApp

func CreateHelmChartApp(c *check.C, apps app.Applications, locator loc.Locator) *app.Application

CreateHelmChartApp creates a new test Helm chart application with the specified locator in the provided app service.

func CreatePackage

func CreatePackage(req PackageRequest, c *check.C) (pkg *pack.PackageEnvelope)

CreatePackage creates a new test package as described by the given request

func CreatePackageData

func CreatePackageData(items []*archive.Item, c *check.C) bytes.Buffer

CreatePackageData generates and returns a new tarball with the specified contents

func KubernetesResources

func KubernetesResources() *archive.Item

KubernetesResources returns test kubernetes resources

func NewDependency

func NewDependency(pkgLoc string) schema.Dependency

NewDependency is a convenience helper to create a manifest Dependency from a package locator

Types

type App

type App struct {
	// Manifest describes the application to create
	Manifest schema.Manifest
	// Base describes the optional base (runtime) application
	Base *App
	// Labels optionally specifies application package labels
	Labels map[string]string
	// Items optionally specifies the contents of the application package.
	Items []*archive.Item
	// Dependencies optionally specify the application's dependencies.
	// These override dependencies from the manifest with actual data.
	Dependencies Dependencies
}

App describes a test application package

func ClusterApplication

func ClusterApplication(appLoc loc.Locator, base App) *App

ClusterApplication creates a new cluster application with the given locator and the runtime application

func DefaultClusterApplication

func DefaultClusterApplication(appLoc loc.Locator) *App

DefaultClusterApplication creates a new cluster application with defaults

func DefaultRuntimeApplication

func DefaultRuntimeApplication() *App

DefaultRuntimeApplication returns a default test runtime application

func RuntimeApplication

func RuntimeApplication(appLoc, runtimePackageLoc loc.Locator) *App

RuntimeApplication returns a test runtime application given the application locator and the locator for the runtime (planet) package

func SystemApplication

func SystemApplication(appLoc loc.Locator) *App

SystemApplication creates a new test system application

func (App) Build

func (r App) Build() App

Build returns this application value. This is usually the last call in the sequence of build APIs before passing to CreateApplication:

app := CreateApplication(AppRequest{
	App: ClusterApplication(...).WithItems(...).WithDependencies(...).Build(),
	Apps: ...,
})

func (App) Locator

func (r App) Locator() loc.Locator

Locator returns the application package locator

func (*App) WithAppDependencies

func (r *App) WithAppDependencies(deps ...App) *App

WithAppDependencies defines the application dependencies. Dependencies will be also automatically reflected in the manifest.

func (*App) WithDependencies

func (r *App) WithDependencies(deps Dependencies) *App

WithDependencies defines the application package/application dependencies. Dependencies will be also automatically reflected in the manifest.

func (*App) WithItems

func (r *App) WithItems(items ...*archive.Item) *App

WithItems sets the content items for this application

func (*App) WithPackageDependencies

func (r *App) WithPackageDependencies(deps ...Package) *App

WithPackageDependencies defines the application package dependencies. Dependencies will be also automatically reflected in the manifest.

func (*App) WithSchemaDependencies

func (r *App) WithSchemaDependencies(deps schema.Dependencies) *App

WithSchemaDependencies defines the application package/application dependencies. These dependencies will only be reflected in the manifest.

func (*App) WithSchemaPackageDependencies

func (r *App) WithSchemaPackageDependencies(deps ...loc.Locator) *App

WithSchemaPackageDependencies defines the application package dependencies. These dependencies will only be reflected in the manifest.

type AppRequest

type AppRequest struct {
	// Packages specifies the package service where packages will be created
	Packages pack.PackageService
	// PackageSets optionally specifies a set of package services to create package in.
	// Each service will receive the same copy of the package contents
	// Either Packages or PackageSets is expected to be set but not both
	PackageSets []pack.PackageService
	// Apps specifies the application service where the package is to be created.
	Apps app.Applications
	// AppSets optionally specifies a set of application services to create application in.
	// Each service will receive the same copy of the application package contents.
	// Either Apps or AppSets is expected to be set but not both
	AppSets []app.Applications
	// App defines the application package to create
	App App
}

AppRequest describes an intent to create a test application package

type Dependencies

type Dependencies struct {
	// Packages lists package dependencies.
	Packages []Package
	// Apps lists application package dependencies.
	Apps []App
}

Dependencies groups package/application dependencies

type Package

type Package struct {
	// Loc identifies the package to create
	Loc loc.Locator
	// Labels optionally specifies package labels
	Labels map[string]string
	// Items optionally specifies the contents of the package.
	Items []*archive.Item
}

Package describes a test package

type PackageRequest

type PackageRequest struct {
	// Packages specifies the package service where the package is to be created
	Packages pack.PackageService
	// PackageSets optionally specifies a set of package services to create package in.
	// Each service will receive the same copy of the package contents
	PackageSets []pack.PackageService
	// Package describes the package to create
	Package Package
}

PackageRequest describes an intent to create a test package

Jump to

Keyboard shortcuts

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