docker: github.com/docker/docker/testutil/registry Index | Files

package registry

import "github.com/docker/docker/testutil/registry"

Index

Package Files

ops.go registry.go registry_mock.go

Constants

const (
    // V2binary is the name of the registry v2 binary
    V2binary = "registry-v2"
    // V2binarySchema1 is the name of the registry that serve schema1
    V2binarySchema1 = "registry-v2-schema1"
    // DefaultURL is the default url that will be used by the registry (if not specified otherwise)
    DefaultURL = "127.0.0.1:5000"
)

func Htpasswd Uses

func Htpasswd(c *Config)

Htpasswd sets the auth method with htpasswd

func Schema1 Uses

func Schema1(c *Config)

Schema1 sets the registry to serve v1 api

func Token Uses

func Token(tokenURL string) func(*Config)

Token sets the auth method to token, with the specified token url

func URL Uses

func URL(registryURL string) func(*Config)

URL sets the registry url

func WithStderr Uses

func WithStderr(w io.Writer) func(c *Config)

WithStderr sets the stdout of the registry command to the passed in writer.

func WithStdout Uses

func WithStdout(w io.Writer) func(c *Config)

WithStdout sets the stdout of the registry command to the passed in writer.

type Config Uses

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

Config contains the test registry configuration

type Mock Uses

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

Mock represent a registry mock

func NewMock Uses

func NewMock(t testing.TB) (*Mock, error)

NewMock creates a registry mock

func (*Mock) Close Uses

func (tr *Mock) Close()

Close closes mock and releases resources

func (*Mock) RegisterHandler Uses

func (tr *Mock) RegisterHandler(path string, h handlerFunc)

RegisterHandler register the specified handler for the registry mock

func (*Mock) URL Uses

func (tr *Mock) URL() string

URL returns the url of the registry

type V2 Uses

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

V2 represent a registry version 2

func NewV2 Uses

func NewV2(t testing.TB, ops ...func(*Config)) *V2

NewV2 creates a v2 registry server

func (*V2) Close Uses

func (r *V2) Close()

Close kills the registry server

func (*V2) Email Uses

func (r *V2) Email() string

Email returns the configured email of the server

func (*V2) Password Uses

func (r *V2) Password() string

Password returns the configured password of the server

func (*V2) Path Uses

func (r *V2) Path() string

Path returns the path where the registry write data

func (*V2) Ping Uses

func (r *V2) Ping() error

Ping sends an http request to the current registry, and fail if it doesn't respond correctly

func (*V2) ReadBlobContents Uses

func (r *V2) ReadBlobContents(t testing.TB, blobDigest digest.Digest) []byte

ReadBlobContents read the file corresponding to the specified digest

func (*V2) TempMoveBlobData Uses

func (r *V2) TempMoveBlobData(t testing.TB, blobDigest digest.Digest) (undo func())

TempMoveBlobData moves the existing data file aside, so that we can replace it with a malicious blob of data for example.

func (*V2) Username Uses

func (r *V2) Username() string

Username returns the configured user name of the server

func (*V2) WaitReady Uses

func (r *V2) WaitReady(t testing.TB)

WaitReady waits for the registry to be ready to serve requests (or fail after a while)

func (*V2) WriteBlobContents Uses

func (r *V2) WriteBlobContents(t testing.TB, blobDigest digest.Digest, data []byte)

WriteBlobContents write the file corresponding to the specified digest with the given content

Package registry imports 15 packages (graph). Updated 2020-04-29. Refresh now. Tools for package owners.