Documentation
¶
Overview ¶
Package testreg runs an in-memory OCI registry seeded with a small, realistic image graph, for crawler, CLI and API tests.
Index ¶
- type Registry
- func (r *Registry) Delete(ref string)
- func (r *Registry) Digest(short string) string
- func (r *Registry) Layered(base, short string, created time.Time, cfg *v1.Config, cmds ...string) v1.Image
- func (r *Registry) Push(ref string, img v1.Image)
- func (r *Registry) PushIndex(ref string, idx v1.ImageIndex)
- func (r *Registry) Ref(s string) name.Reference
- func (r *Registry) WithProvenance(img v1.Image, materials map[string]string) v1.ImageIndex
- type Shape
- type Synthetic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
Host string
Server *httptest.Server
// Images maps a short name (debian, go-amd64, api, ...) to the image.
Images map[string]v1.Image
// GoIndex is the multi-platform index pushed as base/go:1.22.
GoIndex v1.ImageIndex
// contains filtered or unexported fields
}
Registry is a running test registry and the images pushed to it.
func Start ¶
Start runs a registry with referrers support and pushes:
base/debian:12 one layer base/go:1.22 index: amd64 = debian + 1 layer, arm64 = unrelated payments/api:1.0, :latest go amd64 + 1 layer, labels, env, history payments/worker:v1 go amd64 + 1 layer, OCI base annotations payments/api:sha256-<api>.sig a cosign signature an SBOM referrer for api, through the referrers API
func (*Registry) Layered ¶
func (r *Registry) Layered(base, short string, created time.Time, cfg *v1.Config, cmds ...string) v1.Image
Layered builds a new image on top of a named one, for tests that push more images after Start.
func (*Registry) PushIndex ¶
func (r *Registry) PushIndex(ref string, idx v1.ImageIndex)
PushIndex writes an index to repo:tag.
func (*Registry) WithProvenance ¶ added in v0.3.1
WithProvenance returns an index holding img and, as BuildKit pushes it, an attestation manifest whose SLSA provenance lists materials: purl to digest, such as pkg:docker/node@20 to sha256:….
type Shape ¶ added in v0.2.0
type Shape struct {
// Repos is the number of application repos, split across teams.
Repos int
// Tags is the number of images per repo; each gets its own tag.
Tags int
// MultiArchEvery makes every Nth repo push amd64 and arm64 indexes
// instead of single images. Zero means none.
MultiArchEvery int
// Bases is the number of base images applications build on.
Bases int
}
Shape sizes a synthetic registry.
type Synthetic ¶ added in v0.2.0
type Synthetic struct {
*Registry
// RepoNames lists every repo, bases first.
RepoNames []string
// Tags counts every tag pushed; Manifests counts every platform
// image, which is what a full crawl indexes; Indexes counts the
// multi-platform indexes among the tags.
Tags, Manifests, Indexes int
}
Synthetic holds a generated registry and what it contains.
func StartSynthetic ¶ added in v0.2.0
StartSynthetic runs a registry without referrers support and fills it with a generated organization: base images, then repos of applications built on them, one small layer per image. It is sized for benchmarks, so it pushes concurrently.