devservertest

package
v0.0.0-...-d046166 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package devservertest provides a fake implementation of devservers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// URL is a gs:// URL of a file.
	URL string
	// Data is the content of a file.
	Data []byte
	// Staged indicates if the file has been staged or not.
	Staged bool
}

File represents a file served by a Server. A set of files served by a Server can be specified by the Files option.

func (*File) Copy

func (f *File) Copy() *File

Copy creates a deep copy of a File.

type Option

type Option func(o *options)

Option is an option accepted by NewServer to configure Server initialization.

func Down

func Down() Option

Down returns an option to mark a Server down. Such a server responds negatively to health queries.

func Files

func Files(files []*File) Option

Files returns an option to specify a set of files served by a Server.

func StageHook

func StageHook(f func(gsURL string) error) Option

StageHook returns an option to specify a hook function called before staging a file.

type Server

type Server struct {
	*httptest.Server
	// contains filtered or unexported fields
}

Server is a fake devserver implementation.

func NewServer

func NewServer(opts ...Option) (*Server, error)

NewServer starts a fake devserver using specified options.

func (*Server) Close

func (s *Server) Close()

Close stops the server and releases its associated resources.

Jump to

Keyboard shortcuts

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