juju: github.com/juju/juju/apiserver/testserver Index | Files

package testserver

import "github.com/juju/juju/apiserver/testserver"

Index

Package Files

server.go

func DefaultServerConfig Uses

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

DefaultServerConfig returns the default configuration for starting a test server.

type Server Uses

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 Uses

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 Uses

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 Uses

func (s *Server) Stop() error

Stop stops both the API and HTTP servers.

Package testserver imports 22 packages (graph). Updated 2019-08-23. Refresh now. Tools for package owners.