Documentation ¶
Overview ¶
Package testing provides a fake implementation of the Docker API, useful for testing purpose.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DockerServer ¶
type DockerServer struct {
// contains filtered or unexported fields
}
DockerServer represents a programmable, concurrent (not much), HTTP server implementing a fake version of the Docker remote API.
It can used in standalone mode, listening for connections or as an arbitrary HTTP handler.
For more details on the remote API, check http://goo.gl/yMI1S.
func NewServer ¶
func NewServer(bind string, hook func(*http.Request)) (*DockerServer, error)
NewServer returns a new instance of the fake server, in standalone mode. Use the method URL to get the URL of the server.
It receives the bind address (use 127.0.0.1:0 for getting an available port on the host) and a hook function, that will be called on every request.
func (*DockerServer) ServeHTTP ¶
func (s *DockerServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles HTTP requests sent to the server.
func (*DockerServer) URL ¶
func (s *DockerServer) URL() string
URL returns the HTTP URL of the server.