Documentation
¶
Overview ¶
Package jig declares a Kubernetes environment and the checks that prove it correct. A jig is one YAML file: the cluster and its images and dependencies (environment), the steps that deploy and act on the workload (prepare), the checks (expect), and what to run on failure and at the end.
A run has four phases: Environment, Prepare, Assert, Report. Expectations run after the environment, after a named prepare step, or after the last one.
decl, err := jig.FromFile("jig.yaml")
errs := jig.Validate(d)
result, err := jig.Run(ctx, decl, jig.Options{})
Index ¶
- Constants
- Variables
- func Discover(root string, skip []string) ([]string, error)
- func IsExpectIncludeDoc(path string) (bool, error)
- func IsExternalIncludeDoc(path string) (bool, error)
- func Plan(w io.Writer, d *Declaration)
- func ValidClusterProviders() []string
- func Validate(d *Declaration) []error
- func ValidateExternal(expects Expectations) []error
- func ValidateExternalCalls(loc string, calls []ExternalCheck) []error
- func ValidateKubectl(expects Expectations, baseDir string) []error
- func ValidateKubectlBlock(loc string, k *Kubectl, baseDir string, post bool) []error
- func ValidateWith(d *Declaration, funcs template.FuncMap) []error
- type After
- type ApplyEntries
- type ApplyEntry
- type ApplyInclude
- type Cluster
- type ClusterProvider
- type Command
- type Commands
- type DataService
- type Declaration
- type Ecosystem
- type EcosystemDefine
- type EcosystemExport
- type EcosystemKafka
- type EcosystemMariadb
- type EcosystemPostgres
- type EcosystemRabbitmq
- type EcosystemRedis
- type EcosystemSecrets
- type Environment
- type ExpectInclude
- type Expectation
- type ExpectationScope
- type Expectations
- type ExternalCheck
- type ExternalChecks
- type ExternalInclude
- type Finally
- type Function
- type Functions
- type HelmInclude
- type HelmInstall
- type HelmInstalls
- type ImagesInclude
- type Import
- type Kubectl
- type KubectlApply
- type KubectlAuth
- type KubectlCp
- type KubectlDelete
- type KubectlDescribe
- type KubectlEvents
- type KubectlExec
- type KubectlGet
- type KubectlLeaderElection
- type KubectlLogs
- type KubectlPatch
- type KubectlPortForward
- type KubectlRestart
- type KubectlScale
- type KubectlTop
- type LogsPods
- type OnFailure
- type Options
- type Paths
- type Provision
- type ResourceCheck
- type Restart
- type Restarts
- type Result
- type SideEffects
- type Step
- type Steps
- type Wait
- type Waits
Constants ¶
const ( AfterEnvironment = spec.AfterEnvironment AfterPrepare = spec.AfterPrepare ProviderKind = spec.ProviderKind ProviderNone = spec.ProviderNone LogsPodsAny = spec.LogsPodsAny LogsPodsAll = spec.LogsPodsAll )
const FileName = "jig.yaml"
FileName is the file jig reads in a directory, and finds in discovery.
Variables ¶
var ValidLogsPodsValues = spec.ValidLogsPodsValues
ValidLogsPodsValues are kubectl.logs' pods values.
Functions ¶
func Discover ¶
Discover returns every jig.yaml under root, sorted, as absolute paths, leaving out the ones that only import (a suite runs its imports, which discovery finds on their own) and those whose path matches a skip pattern.
func IsExpectIncludeDoc ¶
IsExpectIncludeDoc reports whether the file is an expect include.
func IsExternalIncludeDoc ¶
IsExternalIncludeDoc reports whether the file is an external check include.
func Plan ¶
func Plan(w io.Writer, d *Declaration)
Plan prints what a run of t does, in order: the cluster, the environment and its images, the steps, the imports, each expectation with when it runs, and the env names nothing sets. jig validate and jig run --dry-run print it; a caller validating its own format prints it for the jig.
func ValidClusterProviders ¶
func ValidClusterProviders() []string
ValidClusterProviders returns the supported providers, in display order.
func ValidateExternal ¶
func ValidateExternal(expects Expectations) []error
ValidateExternal returns every problem with the expectations' external checks.
func ValidateExternalCalls ¶
func ValidateExternalCalls(loc string, calls []ExternalCheck) []error
ValidateExternalCalls returns every problem with the external calls at loc.
func ValidateKubectl ¶
func ValidateKubectl(expects Expectations, baseDir string) []error
ValidateKubectl returns every problem with the expectations' kubectl checks; relative paths resolve against baseDir.
func ValidateKubectlBlock ¶
ValidateKubectlBlock returns every problem with one kubectl block at loc; post is set for onFailure and finally.
func ValidateWith ¶
func ValidateWith(d *Declaration, funcs template.FuncMap) []error
ValidateWith is Validate for a caller that runs with its own template functions (Options.Functions): templates are checked against funcs.
Types ¶
type ApplyEntries ¶
type ApplyEntries = spec.ApplyEntries
A jig's vocabulary, for callers: they import jig, not its packages.
func ApplyShorthand ¶
func ApplyShorthand(value *yaml.Node) ApplyEntries
ApplyShorthand reads an apply written as a path or a list of paths; nil when it is neither.
type ApplyEntry ¶
type ApplyEntry = spec.ApplyEntry
A jig's vocabulary, for callers: they import jig, not its packages.
type ApplyInclude ¶
type ApplyInclude = spec.ApplyInclude
A jig's vocabulary, for callers: they import jig, not its packages.
type ClusterProvider ¶
type ClusterProvider = spec.ClusterProvider
A jig's vocabulary, for callers: they import jig, not its packages.
type DataService ¶
type DataService = spec.DataService
A jig's vocabulary, for callers: they import jig, not its packages.
type Declaration ¶
type Declaration = spec.Declaration
Declaration is a jig: a jig.yaml.
func FromFile ¶
func FromFile(path string) (*Declaration, error)
FromFile reads and checks the jig at path: includes expanded, relative paths resolved from its directory. An error lists every problem.
type EcosystemDefine ¶
type EcosystemDefine = spec.EcosystemDefine
A jig's vocabulary, for callers: they import jig, not its packages.
type EcosystemExport ¶
type EcosystemExport = spec.EcosystemExport
A jig's vocabulary, for callers: they import jig, not its packages.
type EcosystemKafka ¶
type EcosystemKafka = spec.EcosystemKafka
A jig's vocabulary, for callers: they import jig, not its packages.
type EcosystemMariadb ¶
type EcosystemMariadb = spec.EcosystemMariadb
A jig's vocabulary, for callers: they import jig, not its packages.
type EcosystemPostgres ¶
type EcosystemPostgres = spec.EcosystemPostgres
A jig's vocabulary, for callers: they import jig, not its packages.
type EcosystemRabbitmq ¶
type EcosystemRabbitmq = spec.EcosystemRabbitmq
A jig's vocabulary, for callers: they import jig, not its packages.
type EcosystemRedis ¶
type EcosystemRedis = spec.EcosystemRedis
A jig's vocabulary, for callers: they import jig, not its packages.
type EcosystemSecrets ¶
type EcosystemSecrets = spec.EcosystemSecrets
A jig's vocabulary, for callers: they import jig, not its packages.
type ExpectInclude ¶
type ExpectInclude = spec.ExpectInclude
A jig's vocabulary, for callers: they import jig, not its packages.
type Expectation ¶
type Expectation = spec.Expectation
A jig's vocabulary, for callers: they import jig, not its packages.
type ExpectationScope ¶
type ExpectationScope = spec.ExpectationScope
A jig's vocabulary, for callers: they import jig, not its packages.
type Expectations ¶
type Expectations = spec.Expectations
A jig's vocabulary, for callers: they import jig, not its packages.
type ExternalCheck ¶
type ExternalCheck = spec.ExternalCheck
A jig's vocabulary, for callers: they import jig, not its packages.
type ExternalChecks ¶
type ExternalChecks = spec.ExternalChecks
A jig's vocabulary, for callers: they import jig, not its packages.
type ExternalInclude ¶
type ExternalInclude = spec.ExternalInclude
A jig's vocabulary, for callers: they import jig, not its packages.
type HelmInclude ¶
type HelmInclude = spec.HelmInclude
A jig's vocabulary, for callers: they import jig, not its packages.
type HelmInstall ¶
type HelmInstall = spec.HelmInstall
A jig's vocabulary, for callers: they import jig, not its packages.
type HelmInstalls ¶
type HelmInstalls = spec.HelmInstalls
A jig's vocabulary, for callers: they import jig, not its packages.
type ImagesInclude ¶
type ImagesInclude = spec.ImagesInclude
ImagesInclude, ApplyInclude and HelmInclude are the files an include: entry in an images, apply or helm list names.
type KubectlApply ¶
type KubectlApply = spec.KubectlApply
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlAuth ¶
type KubectlAuth = spec.KubectlAuth
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlDelete ¶
type KubectlDelete = spec.KubectlDelete
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlDescribe ¶
type KubectlDescribe = spec.KubectlDescribe
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlEvents ¶
type KubectlEvents = spec.KubectlEvents
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlExec ¶
type KubectlExec = spec.KubectlExec
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlGet ¶
type KubectlGet = spec.KubectlGet
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlLeaderElection ¶
type KubectlLeaderElection = spec.KubectlLeaderElection
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlLogs ¶
type KubectlLogs = spec.KubectlLogs
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlPatch ¶
type KubectlPatch = spec.KubectlPatch
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlPortForward ¶
type KubectlPortForward = spec.KubectlPortForward
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlRestart ¶
type KubectlRestart = spec.KubectlRestart
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlScale ¶
type KubectlScale = spec.KubectlScale
A jig's vocabulary, for callers: they import jig, not its packages.
type KubectlTop ¶
type KubectlTop = spec.KubectlTop
A jig's vocabulary, for callers: they import jig, not its packages.
type ResourceCheck ¶
type ResourceCheck = spec.ResourceCheck
A jig's vocabulary, for callers: they import jig, not its packages.
type Result ¶
Result is a run's result, as the report shows it.
type SideEffects ¶
type SideEffects = spec.SideEffects
A jig's vocabulary, for callers: they import jig, not its packages.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
cli
Package cli is the jig command line: validate a jig, run it, clean up what a run kept, and print the version.
|
Package cli is the jig command line: validate a jig, run it, clean up what a run kept, and print the version. |
|
jig
command
Command jig runs declarative Kubernetes tests (see package cli).
|
Command jig runs declarative Kubernetes tests (see package cli). |
|
pkg
|
|
|
check
Package check is the whole check of a jig, offline: its shape (spec), what a test without a cluster can't do, the files it names, its kubectl blocks and external calls, its side effects, and its images.
|
Package check is the whole check of a jig, offline: its shape (spec), what a test without a cluster can't do, the files it names, its kubectl blocks and external calls, its side effects, and its images. |
|
ecosystem
Package ecosystem installs the data services a jig declares (environment.ecosystem): the operators they need, the data-services chart with values built from the declaration, and the Secrets that carry each service's connection details to the workload.
|
Package ecosystem installs the data services a jig declares (environment.ecosystem): the operators they need, the data-services chart with values built from the declaration, and the Secrets that carry each service's connection details to the workload. |
|
ecosystem/operator
Package operator installs the Kubernetes operators jig's data services need: each a Helm chart or a release manifest, pinned per jig release.
|
Package operator installs the Kubernetes operators jig's data services need: each a Helm chart or a release manifest, pinned per jig release. |
|
expect
Package expect provides E2E expectation execution and result types.
|
Package expect provides E2E expectation execution and result types. |
|
expect/report
Package report renders jig results as Markdown, JSON and JUnit XML reports.
|
Package report renders jig results as Markdown, JSON and JUnit XML reports. |
|
gitsource
Package gitsource checks out the repository an image is built from (environment.images[].git): a remote one, cloned once into a cache and fetched as git.pull says, or a local one, used as it is.
|
Package gitsource checks out the repository an image is built from (environment.images[].git): a remote one, cloned once into a cache and fetched as git.pull says, or a local one, used as it is. |
|
kubectl
Package kubectl provides helpers for interacting with Kubernetes through kubectl.
|
Package kubectl provides helpers for interacting with Kubernetes through kubectl. |
|
post
Package post tears a jig run down: what it applied and installed, removed in reverse once its expectations and imports have run.
|
Package post tears a jig run down: what it applied and installed, removed in reverse once its expectations and imports have run. |
|
runner
Package runner runs a jig: it provides the cluster, loads the images, provisions the environment, runs the prepare steps in order with the expectations that follow each, runs the imports, tears down what it did, and writes the report.
|
Package runner runs a jig: it provides the cluster, loads the images, provisions the environment, runs the prepare steps in order with the expectations that follow each, runs the imports, tears down what it did, and writes the report. |
|
spec
Package spec is the jig document: the environment, the prepare steps, the expectations and what runs on failure and at the end, as a jig.yaml declares them, with FromFile to read one and Validate to check it.
|
Package spec is the jig document: the environment, the prepare steps, the expectations and what runs on failure and at the end, as a jig.yaml declares them, with FromFile to read one and Validate to check it. |