Documentation
¶
Overview ¶
Package registrytest spins an in-process OCI distribution registry for diffah's integration tests. Wraps go-containerregistry's in-process registry with optional Basic-auth, bearer-token, TLS, fault-injection, and access-logging middleware. Provides only what diffah needs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlobRequest ¶
BlobRequest records a single GET/HEAD for /v2/<repo>/blobs/<digest>.
type ManifestRequest ¶
ManifestRequest records a single GET/HEAD for /v2/<repo>/manifests/<reference>. Reference may be a tag (e.g. "v1") or a digest ("sha256:..."). Tracked so integration tests can budget how many times preflight + apply collectively pull a baseline manifest.
type Option ¶
type Option func(*config)
Option configures the registrytest Server.
func WithBasicAuth ¶
WithBasicAuth enables HTTP Basic-auth middleware.
func WithBearerToken ¶
WithBearerToken enables Bearer-token middleware.
func WithInjectFault ¶
WithInjectFault makes the first failN matching requests return status. Use e.g. failN=2 to exercise a 3-retry loop that succeeds on attempt 3.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the in-process registry returned by New.
func New ¶
New starts a fresh in-process registry and registers t.Cleanup to shut it down. Use Options to add middleware.
func (*Server) BlobHits ¶
func (s *Server) BlobHits() []BlobRequest
BlobHits returns every /v2/<repo>/blobs/<digest> request observed. Tests use it to assert lazy-fetch behaviour.
func (*Server) CACertPEM ¶
CACertPEM returns the PEM-encoded server certificate (which doubles as the CA in this harness's self-signed chain). Empty if WithTLS was not passed.
func (*Server) ClientCertDir ¶
ClientCertDir returns a directory suitable for --cert-dir, containing registry.crt. Empty if WithTLS was not passed.
func (*Server) ManifestHits ¶
func (s *Server) ManifestHits() []ManifestRequest
ManifestHits returns every /v2/<repo>/manifests/<reference> request observed. Used by preflight tests to assert that pre-flight does not regress baseline manifest GET counts.
func (*Server) URL ¶
URL returns the base URL of the test registry (e.g. http://127.0.0.1:XXXX).