testserver

package
v0.0.0-...-8ff1004 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultServerConfig

func DefaultServerConfig(c *gc.C) apiserver.ServerConfig

DefaultServerConfig returns the default configuration for starting a test server.

Types

type Server

type Server struct {
	APIServer  *apiserver.Server
	HTTPServer *httptest.Server
	Info       *api.Info
}

Server wraps both the HTTP and API servers needed to test API interactions and simplifies managing their lifecycles.

func NewServer

func NewServer(c *gc.C, statePool *state.StatePool, controller *cache.Controller) *Server

NewServer returns a new running API server using the given state. The pool may be nil, in which case a pool using the given state will be used.

It returns information suitable for connecting to the state without any authentication information or model tag, and the server that's been started.

func NewServerWithConfig

func NewServerWithConfig(c *gc.C, statePool *state.StatePool, cfg apiserver.ServerConfig) *Server

NewServerWithConfig is like NewServer except that the entire server configuration may be specified (see DefaultServerConfig for a suitable starting point).

func (*Server) Stop

func (s *Server) Stop() error

Stop stops both the API and HTTP servers.

Jump to

Keyboard shortcuts

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