Documentation
¶
Overview ¶
Package ocitest provides an in-process OCI registry for tests, so tests never depend on real network access or a real container registry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRegistry ¶
NewRegistry starts an in-process OCI registry serving a single image built from files (archive path -> content, one uncompressed-tar layer). It returns the bare image reference "127.0.0.1:PORT/repoTag" (no "oci://" prefix, no scheme) -- callers building a component source.uri prefix it with "oci://" themselves. The go-containerregistry name.ParseReference function treats "127.0.0.1:PORT" addresses as plain HTTP automatically (see go-containerregistry's pkg/name/registry.go reLoopback), so no Insecure option is needed. The registry's httptest.Server is closed automatically via t.Cleanup.
func NewZipRegistry ¶
NewZipRegistry starts an in-process OCI registry serving a single image whose sole layer is a ZIP archive with media type "archive/zip" -- the format OpenTofu's native "install modules from OCI registries" feature uses (see https://opentofu.org, artifactType application/vnd.opentofu.modulepkg). Unlike NewRegistry's layer, this one is not gzip-wrapped: the blob is the raw zip bytes, matching what real OpenTofu module-package registries serve.
Types ¶
This section is empty.