summaryrefslogtreecommitdiff
path: root/client/container_create_test.go
diff options
context:
space:
mode:
authorStephen J Day <stephen.day@docker.com>2016-09-08 20:44:25 -0700
committerStephen J Day <stephen.day@docker.com>2016-09-19 11:19:55 -0700
commit9a072adff3fcd90c4f36214b355ef27b423f0144 (patch)
tree6446b5142faf77cfdd5af70093ed450b2f78bdf6 /client/container_create_test.go
parent9d7be9df8f79b26a4b9778851cf19a6579f8bc61 (diff)
downloaddocker-9a072adff3fcd90c4f36214b355ef27b423f0144.tar.gz
client: remove transport package
This package doesn't really seem to do anything of real interest. Removing it and replacing with a few helper functions. Most of this was maintaining a fork of ctxhttp to support a mock that was unnecessary. We could probably do with a further refactor of the client interface. There is a lot of confusion of between transport, http layer and application layer that makes for some awkward code. This change improves the situation to the point where no breaking changes are introduced. Signed-off-by: Stephen J Day <stephen.day@docker.com>
Diffstat (limited to 'client/container_create_test.go')
-rw-r--r--client/container_create_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/client/container_create_test.go b/client/container_create_test.go
index 4c14cdc5d1..5325156beb 100644
--- a/client/container_create_test.go
+++ b/client/container_create_test.go
@@ -16,7 +16,7 @@ import (
func TestContainerCreateError(t *testing.T) {
client := &Client{
- transport: newMockClient(nil, errorMock(http.StatusInternalServerError, "Server error")),
+ client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
}
_, err := client.ContainerCreate(context.Background(), nil, nil, nil, "nothing")
if err == nil || err.Error() != "Error response from daemon: Server error" {
@@ -25,7 +25,7 @@ func TestContainerCreateError(t *testing.T) {
// 404 doesn't automagitally means an unknown image
client = &Client{
- transport: newMockClient(nil, errorMock(http.StatusNotFound, "Server error")),
+ client: newMockClient(errorMock(http.StatusNotFound, "Server error")),
}
_, err = client.ContainerCreate(context.Background(), nil, nil, nil, "nothing")
if err == nil || err.Error() != "Error response from daemon: Server error" {
@@ -35,7 +35,7 @@ func TestContainerCreateError(t *testing.T) {
func TestContainerCreateImageNotFound(t *testing.T) {
client := &Client{
- transport: newMockClient(nil, errorMock(http.StatusNotFound, "No such image")),
+ client: newMockClient(errorMock(http.StatusNotFound, "No such image")),
}
_, err := client.ContainerCreate(context.Background(), &container.Config{Image: "unknown_image"}, nil, nil, "unknown")
if err == nil || !IsErrImageNotFound(err) {
@@ -46,7 +46,7 @@ func TestContainerCreateImageNotFound(t *testing.T) {
func TestContainerCreateWithName(t *testing.T) {
expectedURL := "/containers/create"
client := &Client{
- transport: newMockClient(nil, func(req *http.Request) (*http.Response, error) {
+ client: newMockClient(func(req *http.Request) (*http.Response, error) {
if !strings.HasPrefix(req.URL.Path, expectedURL) {
return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
}