Documentation ¶
Overview ¶
Package repotest provides utilities for testing.
The server provides a testing server that can be set up and torn down quickly.
Index ¶
- type Server
- func (s *Server) CopyCharts(origin string) ([]string, error)
- func (s *Server) CreateIndex() error
- func (s *Server) LinkIndices() error
- func (s *Server) Root() string
- func (s *Server) Start()
- func (s *Server) Stop()
- func (s *Server) URL() string
- func (s *Server) WithMiddleware(middleware http.HandlerFunc)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an implementation of a repository server for testing.
func NewServer ¶
NewServer creates a repository server for testing.
docroot should be a temp dir managed by the caller.
This will start the server, serving files off of the docroot.
Use CopyCharts to move charts into the repository and then index them for service.
func NewTempServer ¶
NewTempServer creates a server inside of a temp dir.
If the passed in string is not "", it will be treated as a shell glob, and files will be copied from that path to the server's docroot.
The caller is responsible for destroying the temp directory as well as stopping the server.
func (*Server) CopyCharts ¶
CopyCharts takes a glob expression and copies those charts to the server root.
func (*Server) CreateIndex ¶
CreateIndex will read docroot and generate an index.yaml file.
func (*Server) LinkIndices ¶
LinkIndices links the index created with CreateIndex and makes a symbolic link to the cache index.
This makes it possible to simulate a local cache of a repository.
func (*Server) Stop ¶
func (s *Server) Stop()
Stop stops the server and closes all connections.
It should be called explicitly.
func (*Server) WithMiddleware ¶
func (s *Server) WithMiddleware(middleware http.HandlerFunc)
WithMiddleware injects middleware in front of the server. This can be used to inject additional functionality like layering in an authentication frontend.