Help us shape the future of Go! Take the 2026 Go Developer Survey

test

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTLSServer added in v0.25.0

func CreateTLSServer() (*httptest.Server, []byte, []byte, []byte, tls.Certificate, error)

func LoadImages

func LoadImages(srv *httptest.Server, imageName string, versions []string, options ...remote.Option) (string, map[string]v1.Hash, error)

LoadImages uploads images to the local registry, and returns the image repo name. https://github.com/google/go-containerregistry/blob/v0.1.1/pkg/registry/compatibility_test.go has an example of loading a test registry with a random image.

func NewAuthenticatedRegistryServer

func NewAuthenticatedRegistryServer(username, pass string) *httptest.Server

func NewListener added in v0.33.0

func NewListener(t *testing.T) (net.Listener, string, int)

NewListener creates a TCP listener on a random port and returns the listener, the address and the port of this listener. It also registers a cleanup function to close the listener when the test ends.

func NewProxy added in v0.33.0

func NewProxy(t *testing.T) (string, int)

NewProxy creates a new goproxy server on a random port and returns the address and the port of this server. It also registers a cleanup functions to close the server and the listener when the test ends.

func NewRegistryServer

func NewRegistryServer() *httptest.Server

set up a local registry for testing scanning

func RegistryName

func RegistryName(srv *httptest.Server) string

Get the registry part of an image from the registry server

Types

type AuthHandler

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

func (*AuthHandler) ServeHTTP

func (h *AuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves a request which needs authentication.

type TagListHandler

type TagListHandler struct {
	RegistryHandler http.Handler
	Imagetags       map[string][]string
}

func (*TagListHandler) ServeHTTP

func (h *TagListHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TagListResult

type TagListResult struct {
	Name string   `json:"name"`
	Tags []string `json:"tags"`
}

Jump to

Keyboard shortcuts

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