registrytest

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func New

func New(t testing.TB) *Registry

func (*Registry) Close added in v0.3.0

func (r *Registry) Close()

Close stops serving before the test ends, so a test can assert that what follows needs no registry rather than merely assuming it. Cleanup closes the server too; both calls are safe.

func (*Registry) CopyManifest

func (r *Registry) CopyManifest(repo, srcRef, dstRef string)

CopyManifest republished the manifest stored under srcRef in repo under dstRef, to simulate signature-substitution attacks in tests.

func (*Registry) CountRequests

func (r *Registry) CountRequests(method, pathPart string) int

countRequests returns how many logged requests match method and a path substring.

func (*Registry) HasBlob

func (r *Registry) HasBlob(repo string, d digest.Digest) bool

func (*Registry) HasManifest

func (r *Registry) HasManifest(repo, ref string) bool

HasManifest reports whether repo has a manifest under ref.

func (*Registry) Host

func (r *Registry) Host() string

host returns the registry host:port (no scheme).

func (*Registry) PutBlob

func (r *Registry) PutBlob(repo string, content []byte) digest.Digest

func (*Registry) PutManifest

func (r *Registry) PutManifest(repo, ref, mediaType string, data []byte) digest.Digest

func (*Registry) RangeRequests

func (r *Registry) RangeRequests(d digest.Digest) []string

rangeRequests returns the Range header values seen on GETs of the blob.

func (*Registry) Requests

func (r *Registry) Requests() []ReqRecord

Requests returns a snapshot of the request log.

func (*Registry) ServeHTTP

func (r *Registry) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Registry) SetCorruptBlob

func (r *Registry) SetCorruptBlob(d digest.Digest)

SetCorruptBlob serves flipped bytes for this digest.

func (*Registry) SetFailBlobReads

func (r *Registry) SetFailBlobReads(d digest.Digest, n int, afterBytes int64)

SetFailBlobReads makes the next n GETs of blob d serve only afterBytes bytes and then drop the connection.

func (*Registry) SetIgnoreRange

func (r *Registry) SetIgnoreRange(v bool)

SetIgnoreRange makes blob GETs disregard Range headers.

func (*Registry) SetMissingManifestStatus added in v0.3.0

func (r *Registry) SetMissingManifestStatus(code int)

SetMissingManifestStatus changes what an unknown manifest answers. Real registries are not consistent about this, and code that treats only 404 as "absent" breaks against the ones that refuse to confirm existence.

type ReqRecord

type ReqRecord struct {
	Method string
	Path   string
	Range  string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL