repotest

package
v2.17.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package repotest provides utilities for testing.

The server provides a testing server that can be set up and torn down quickly.

Index

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

func NewServer(docroot string) *Server

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

func NewTempServer(glob string) (*Server, helmpath.Home, error)

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

func (s *Server) CopyCharts(origin string) ([]string, error)

CopyCharts takes a glob expression and copies those charts to the server root.

func (*Server) CreateIndex

func (s *Server) CreateIndex() error

CreateIndex will read docroot and generate an index.yaml file.

func (*Server) LinkIndices

func (s *Server) LinkIndices() error

LinkIndices links the index created with CreateIndex and makes a symbolic link to the repositories/cache directory.

This makes it possible to simulate a local cache of a repository.

func (*Server) Root

func (s *Server) Root() string

Root gets the docroot for the server.

func (*Server) Stop

func (s *Server) Stop()

Stop stops the server and closes all connections.

It should be called explicitly.

func (*Server) URL

func (s *Server) URL() string

URL returns the URL of the server.

Example:

http://localhost:1776

Jump to

Keyboard shortcuts

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