Documentation ¶
Index ¶
- Variables
- func BrokerConfiguration() dockerapi.BrokerConfiguration
- func CleanupSQL(persister brokerapi.Persister)
- func NewDockerServices() []brokerapi.Service
- func NewPersister() brokerapi.Persister
- func NewServiceAgent() brokerapi.ServiceAgent
- func RemoveWhiteSpaceFromBody(body string) string
- func SetupSQL(persister brokerapi.Persister)
- func SimpleDispatcher() brokerapi.DispatcherInterface
- type FakeDocker
- type JSONArrayRequest
- type JSONMapRequest
- type RequestMatcher
- type TestHandler
- func NewBrokerService(serviceagent brokerapi.ServiceAgent, persister brokerapi.Persister, ...) (*dockerapi.DockerClient, brokerapi.ServiceAgent, *httptest.Server, ...)
- func NewBrokerServiceWithMultipleRequests(serviceagent brokerapi.ServiceAgent, persister brokerapi.Persister, ...) (*dockerapi.DockerClient, brokerapi.ServiceAgent, *httptest.Server, ...)
- func NewServer(requests []TestRequest) (*httptest.Server, *TestHandler)
- func NewTLSServer(requests []TestRequest) (*httptest.Server, *TestHandler)
- type TestRequest
- type TestResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var Deprovision_RemoveContainerRequest = NewTestRequest(TestRequest{ Method: "DELETE", Path: "/containers/myFakeInstance", Response: TestResponse{ Status: http.StatusOK, }, })
View Source
var Deprovision_StopContainerRequest = NewTestRequest(TestRequest{ Method: "POST", Path: "/containers/myFakeInstance/stop?t=0", Response: TestResponse{ Status: http.StatusOK, }, })
View Source
var Exec_CommandResponse = map[string]map[string]interface{}{ "Provision": {"host": "fakeHost", "port": "1234", "user": "fakeUser", "password": "fakePassword", "database": "fakeDB", "url": "mysql://fakehost:1234"}, "Bind": {"host": "fakeHost", "port": "1234", "user": "fakeUser", "password": "fakePassword", "database": "fakeDB", "url": "mysql://fakehost:1234"}, "Deprovision": {"remove": true}, }
View Source
var Provision_CreateContainerRequest = NewTestRequest(TestRequest{ Method: "POST", Path: "/containers/create?name=myFakeInstance", Matcher: RequestBodyMatcher(`{"User": "","Memory": 0,"PortSpecs": null,"StdinOnce": false, "Image": "mysql","Domainname": "","Cpuset": "","AttachStderr": false,"ExposedPorts": null,"Tty": false,"Cmd": null,"MemorySwap": 0,"CpuShares": 0,"AttachStdin": false,"OpenStdin": false,"WorkingDir": "","NetworkDisabled": false,"OnBuild": null, "Hostname": "myFakeInstance","AttachStdout": false,"Env": null,"Volumes": null,"Entrypoint": null}`), Response: TestResponse{ Status: http.StatusOK, Body: `{ "Id":"myFakeInstance", "Warnings":[] }`, }, })
View Source
var Provision_InspectContainerRequest = NewTestRequest(TestRequest{ Method: "GET", Path: "/containers/myFakeInstance/json", Response: TestResponse{ Status: http.StatusOK, Body: `{ "Id": "myFakeInstance", "Created": "2013-05-07T14:51:42.041847+02:00", "Path": "date", "Args": [], "Config": { "Hostname": "myFakeHost", "User": "", "Memory": 0, "MemorySwap": 0, "AttachStdin": false, "AttachStdout": true, "AttachStderr": true, "PortSpecs": null, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": null, "Cmd": [ "date" ], "Dns": null, "Image": "base", "Volumes": {}, "VolumesFrom": "", "WorkingDir":"" }, "State": { "Running": true, "Pid": 0, "ExitCode": 0, "StartedAt": "2013-05-07T14:51:42.087658+02:01360", "Ghost": false }, "Image": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", "NetworkSettings": { "IpAddress": "", "IpPrefixLen": 0, "Gateway": "", "Bridge": "", "PortMapping": null, "Ports": { "1234/tcp": [ { "HostIp": "192.999.888.777", "HostPort": "49153" } ] } }, "SysInitPath": "/home/kitty/go/src/github.com/dotcloud/docker/bin/docker", "ResolvConfPath": "/etc/resolv.conf", "Volumes": {}, "HostConfig": { "Binds": null, "ContainerIDFile": "", "LxcConf": [], "Privileged": false, "PortBindings": { "80/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "49153" } ] }, "Links": ["/name:alias"], "PublishAllPorts": false } }`, }, })
View Source
var Provision_InspectImageRequest = NewTestRequest(TestRequest{ Method: "GET", Path: "/images/mysql/json", Response: TestResponse{ Status: http.StatusOK, Body: `{ "Architecture": "amd64", "Author": "", "Comment": "", "Config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "/bin/sh", "-c", "/run.sh" ], "CpuShares": 0, "Cpuset": "", "Domainname": "", "Entrypoint": null, "Env": [ "HOME=/", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "ExposedPorts": { "3306/tcp": {} }, "Hostname": "347a3d6eaa91", "Image": "aa19bf58589d33f0fb78ab72a240290c32e737615c97de4f3dfcec23d4564753", "Memory": 0, "MemorySwap": 0, "NetworkDisabled": false, "OnBuild": [], "OpenStdin": false, "PortSpecs": null, "StdinOnce": false, "Tty": false, "User": "", "Volumes": null, "WorkingDir": "" }, "Container": "b0bb5fc46d0b07de83327da6dad18add7bc079e9908e640cfaa1d2ea924ed5ad", "ContainerConfig": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "/bin/sh", "-c", "#(nop) CMD [/bin/sh -c /run.sh]" ], "CpuShares": 0, "Cpuset": "", "Domainname": "", "Entrypoint": null, "Env": [ "HOME=/", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "ExposedPorts": { "3306/tcp": {} }, "Hostname": "347a3d6eaa91", "Image": "aa19bf58589d33f0fb78ab72a240290c32e737615c97de4f3dfcec23d4564753", "Memory": 0, "MemorySwap": 0, "NetworkDisabled": false, "OnBuild": [], "OpenStdin": false, "PortSpecs": null, "StdinOnce": false, "Tty": false, "User": "", "Volumes": null, "WorkingDir": "" }, "Created": "2014-09-03T09:16:09.7706864Z", "DockerVersion": "1.0.0", "Id": "10579d0a97b065dd4ea7a6fa7ba9f68372c16e116fc8859146eb5a06be8bd440", "Os": "linux", "Parent": "aa19bf58589d33f0fb78ab72a240290c32e737615c97de4f3dfcec23d4564753", "Size": 0 }`, }, })
View Source
var Provision_ListAllImagesRequest = NewTestRequest(TestRequest{ Method: "GET", Path: "/images/json", Response: TestResponse{ Status: http.StatusOK, Body: `[ { "RepoTags": [ "mysql:5.6.19", "mysql:precise", "mysql:latest" ], "Id": "myFakeImageId1", "Created": 1365714795, "Size": 131506275, "VirtualSize": 131506275 }, { "RepoTags": [ "ubuntu:12.10", "ubuntu:quantal" ], "ParentId": "myFakeParentId2", "Id": "myFakeImageId2", "Created": 1364102658, "Size": 24653, "VirtualSize": 180116135 } ]`, }, })
View Source
var Provision_StartContainerRequest = NewTestRequest(TestRequest{ Method: "POST", Path: "/containers/myFakeInstance/start", Matcher: RequestBodyMatcher(`{"ContainerIDFile": "","Privileged": false,"PublishAllPorts": true,"NetworkMode": "bridge","Binds": null,"PortBindings": null,"Links": null,"Dns": null,"DnsSearch": null,"VolumesFrom": null,"LxcConf": null,"RestartPolicy": {"Name": "","MaximumRetryCount": 0}}`), Response: TestResponse{ Status: http.StatusOK, }, })
Functions ¶
func BrokerConfiguration ¶
func BrokerConfiguration() dockerapi.BrokerConfiguration
func CleanupSQL ¶
func NewDockerServices ¶
func NewPersister ¶
func NewServiceAgent ¶
func NewServiceAgent() brokerapi.ServiceAgent
func SimpleDispatcher ¶
func SimpleDispatcher() brokerapi.DispatcherInterface
Types ¶
type FakeDocker ¶
type JSONArrayRequest ¶
type JSONArrayRequest []interface{}
func (*JSONArrayRequest) String ¶
func (json *JSONArrayRequest) String() string
type JSONMapRequest ¶
type JSONMapRequest map[string]interface{}
func (*JSONMapRequest) String ¶
func (json *JSONMapRequest) String() string
type RequestMatcher ¶
func RequestBodyMatcher ¶
func RequestBodyMatcher(expectedBodyString string) RequestMatcher
func RequestBodyMatcherWithContentType ¶
func RequestBodyMatcherWithContentType(expectedBody, expectedContentType string) RequestMatcher
type TestHandler ¶
type TestHandler struct { Requests []TestRequest CallCount int }
func NewBrokerService ¶
func NewBrokerService(serviceagent brokerapi.ServiceAgent, persister brokerapi.Persister, req TestRequest) (*dockerapi.DockerClient, brokerapi.ServiceAgent, *httptest.Server, *TestHandler)
func NewBrokerServiceWithMultipleRequests ¶
func NewBrokerServiceWithMultipleRequests(serviceagent brokerapi.ServiceAgent, persister brokerapi.Persister, requests []TestRequest) (*dockerapi.DockerClient, brokerapi.ServiceAgent, *httptest.Server, *TestHandler)
func NewServer ¶
func NewServer(requests []TestRequest) (*httptest.Server, *TestHandler)
func NewTLSServer ¶
func NewTLSServer(requests []TestRequest) (*httptest.Server, *TestHandler)
func (*TestHandler) ServeHTTP ¶
func (h *TestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type TestRequest ¶
type TestRequest struct { Method string Path string Header http.Header Matcher RequestMatcher Response TestResponse }
func NewTestRequest ¶
func NewTestRequest(request TestRequest) TestRequest
Click to show internal directories.
Click to hide internal directories.