testing

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

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

Go to latest
Published: Jan 24, 2014 License: BSD-2-Clause Imports: 14 Imported by: 0

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(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.

Hook is a 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) Stop

func (s *DockerServer) Stop()

Stop stops the server.

func (*DockerServer) URL

func (s *DockerServer) URL() string

URL returns the HTTP URL of the server.

Jump to

Keyboard shortcuts

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