empiretest

package
v0.0.0-...-30eb747 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: BSD-2-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractProcfile

func ExtractProcfile(pf procfile.Procfile, err error) empire.ImageRegistry

ExtractProcfile returns an empire.ImageRegistry implementation that writes a fake Docker pull to w, and extracts the given Procfile in yaml format when ExtractProcfile is called.

func NewEmpire

func NewEmpire(t testing.TB) *empire.Empire

NewEmpire returns a new Empire instance suitable for testing. It ensures that the database is clean before returning.

func Run

func Run(m *testing.M)

Run runs testing.M after aquiring a lock against the database.

func SkipCI

func SkipCI(t testing.TB)

Marks the test as skipped when running in CI.

Types

type IdentityProvider

type IdentityProvider struct {
	*saml.IdentityProvider
	// contains filtered or unexported fields
}

IdentityProvider wraps a saml.IdentityProvider to serve it via an httptest.Server.

func NewIdentityProvider

func NewIdentityProvider() *IdentityProvider

NewIdentityProvider returns a new saml.IdentityProvider that can be used for testing the SAML integration.

func (*IdentityProvider) AddServiceProvider

func (idp *IdentityProvider) AddServiceProvider(url string) *saml.ServiceProvider

AddServiceProvider adds a service provider to this IDP.

func (*IdentityProvider) Close

func (idp *IdentityProvider) Close()

Close closes the underlying httptest.Server serving this IdP.

type ImageRegistry

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

ImageRegistry is a fake implementation of the empire.ImageRegistry interface.

func (*ImageRegistry) ExtractProcfile

func (r *ImageRegistry) ExtractProcfile(ctx context.Context, img image.Image, w *jsonmessage.Stream) ([]byte, error)

func (*ImageRegistry) Resolve

func (r *ImageRegistry) Resolve(ctx context.Context, img image.Image, w *jsonmessage.Stream) (image.Image, error)

type Server

type Server struct {
	*empire.Empire
	*server.Server
	// contains filtered or unexported fields
}

Server wraps an Empire instance being served by the canonical server.Server http.Handler, for testing.

func NewServer

func NewServer(t testing.TB, e *empire.Empire) *Server

NewServer builds a new empire.Empire instance and returns an httptest.Server running the Empire API.

The Server is unstarted so that you can perform additional configuration. Consumers should call Start() before makeing any requests.

func (*Server) Close

func (s *Server) Close()

Close closes the underlying httptest.Server.

func (*Server) Start

func (s *Server) Start()

Start starts the underlying httptest.Server.

func (*Server) URL

func (s *Server) URL() string

URL returns that URL that this Empire server is (or will be) located.

Directories

Path Synopsis
Package cli provides test helpers for testing the emp CLI against an Empire environment.
Package cli provides test helpers for testing the emp CLI against an Empire environment.

Jump to

Keyboard shortcuts

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