Documentation
¶
Overview ¶
Package hookedtest provisions sandboxes from a hooked image — one whose `ENV BASH_ENV` file is sandboxtest.BannerHook: it prints on both streams without ending its lines, leaves the directory the shell started in, and sets an EXIT trap that prints on both after whatever the shell ran — on both sandbox backends: the Docker daemon and the Kubernetes cluster the tests run against. It is how a platform script that parses an exec's output is held to answer through an image's startup output on each (#860; sandbox.Frame).
A missing daemon or cluster is a hard failure, as it is for the backends' own contract tests. On a kind cluster the image is loaded into its nodes and removed from them afterwards (sandboxtest.LoadIntoKind, KindLoad.Remove); a cluster that shares the Docker daemon's image store (Docker Desktop's) needs neither.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DockerImage ¶
DockerImage is Image on the Docker daemon alone, for a test of the Docker backend that has no cluster to show it to.
func Image ¶
Image builds an image whose `ENV BASH_ENV` file is hook, on the base the backends' contract tests run, makes it visible to the Kubernetes cluster the tests run against, and removes it from both when the test is done.
Each call builds an image of its own: the same Dockerfile would build the same image ID in every package that asks at once, sharing layers through the build cache, and removing one package's from a kind node takes the image ID, every package's tag with it, out from under pods still running from it. A label carrying a nonce makes the ID this call's alone, its layers still shared, so the removal when the test ends takes this call's image and nothing another package runs.
func KindMissing ¶
KindMissing is what of an image Image built a kind node does not hold (sandboxtest.KindLoad.Missing) — its tag, and its import record where the archive named one — with loaded as KindRefs has it.
func KindRefs ¶
KindRefs is every image reference the kind cluster's nodes hold of an image Image built — none once the test that built it is done — and whether Image loaded it onto a kind cluster at all: false where the cluster is not kind's, so that a check of what is held can tell "nothing to look at" from "nothing found".
Types ¶
type Backend ¶
Backend is one sandbox backend with the hooked image visible to it.
func Backends ¶
Backends builds the hooked image (Image, with sandboxtest.BannerHook) and returns the Docker backend and the Kubernetes one (MAP_K8S_CONTEXT, else the kubeconfig's current context; MAP_K8S_NAMESPACE), each able to run it.
func BackendsFor ¶
BackendsFor is Backends with hook as the image's BASH_ENV file.