summaryrefslogtreecommitdiff
path: root/integration-cli/docker_api_build_test.go
diff options
context:
space:
mode:
authorVincent Demeester <vincent@sbr.pm>2017-02-28 17:12:30 +0100
committerVincent Demeester <vincent@sbr.pm>2017-02-28 17:12:30 +0100
commitf85ee17810ca55a3104f8a7d8945bd16ac526dd0 (patch)
tree8cce8394b3e1a432923e95cc9eb8e0536fcc1df0 /integration-cli/docker_api_build_test.go
parent40532143c2c4cf1359fd8484789b81c1f1f59d98 (diff)
downloaddocker-f85ee17810ca55a3104f8a7d8945bd16ac526dd0.tar.gz
Convert request.SockRequestRaw to appropriate methods
`request.SockRequestRaw` is deprecated, let's use appropriate methods for those. This is a first pass, `SockRequest` still needs to be removed. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat (limited to 'integration-cli/docker_api_build_test.go')
-rw-r--r--integration-cli/docker_api_build_test.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/integration-cli/docker_api_build_test.go b/integration-cli/docker_api_build_test.go
index 3a4353a87b..778e06e2b3 100644
--- a/integration-cli/docker_api_build_test.go
+++ b/integration-cli/docker_api_build_test.go
@@ -3,6 +3,7 @@ package main
import (
"archive/tar"
"bytes"
+ "io/ioutil"
"net/http"
"regexp"
"strings"
@@ -31,7 +32,7 @@ RUN find /tmp/`
server := fakeStorage(c, map[string]string{"testD": testD})
defer server.Close()
- res, body, err := request.SockRequestRaw("POST", "/build?dockerfile=baz&remote="+server.URL()+"/testD", nil, "application/json", daemonHost())
+ res, body, err := request.Post(daemonHost(), "/build?dockerfile=baz&remote="+server.URL()+"/testD", request.JSON)
c.Assert(err, checker.IsNil)
c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
@@ -70,7 +71,7 @@ func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *check.C) {
})
defer server.Close()
- res, b, err := request.SockRequestRaw("POST", "/build?remote="+server.URL()+"/testT.tar", nil, "application/tar", daemonHost())
+ res, b, err := request.Post(daemonHost(), "/build?remote="+server.URL()+"/testT.tar", request.ContentType("application/tar"))
c.Assert(err, checker.IsNil)
c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
b.Close()
@@ -118,7 +119,7 @@ RUN echo 'right'
defer server.Close()
url := "/build?dockerfile=custom&remote=" + server.URL() + "/testT.tar"
- res, body, err := request.SockRequestRaw("POST", url, nil, "application/tar", daemonHost())
+ res, body, err := request.Post(daemonHost(), url, request.ContentType("application/tar"))
c.Assert(err, checker.IsNil)
c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
@@ -137,7 +138,7 @@ RUN echo from dockerfile`,
}, false)
defer git.Close()
- res, body, err := request.SockRequestRaw("POST", "/build?remote="+git.RepoURL, nil, "application/json", daemonHost())
+ res, body, err := request.Post(daemonHost(), "/build?remote="+git.RepoURL, request.JSON)
c.Assert(err, checker.IsNil)
c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
@@ -158,7 +159,7 @@ RUN echo from Dockerfile`,
defer git.Close()
// Make sure it tries to 'dockerfile' query param value
- res, body, err := request.SockRequestRaw("POST", "/build?dockerfile=baz&remote="+git.RepoURL, nil, "application/json", daemonHost())
+ res, body, err := request.Post(daemonHost(), "/build?dockerfile=baz&remote="+git.RepoURL, request.JSON)
c.Assert(err, checker.IsNil)
c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
@@ -180,7 +181,7 @@ RUN echo from dockerfile`,
defer git.Close()
// Make sure it tries to 'dockerfile' query param value
- res, body, err := request.SockRequestRaw("POST", "/build?remote="+git.RepoURL, nil, "application/json", daemonHost())
+ res, body, err := request.Post(daemonHost(), "/build?remote="+git.RepoURL, request.JSON)
c.Assert(err, checker.IsNil)
c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
@@ -227,7 +228,7 @@ func (s *DockerSuite) TestBuildAPIUnnormalizedTarPaths(c *check.C) {
// failed to close tar archive
c.Assert(tw.Close(), checker.IsNil)
- res, body, err := request.SockRequestRaw("POST", "/build", buffer, "application/x-tar", daemonHost())
+ res, body, err := request.Post(daemonHost(), "/build", request.RawContent(ioutil.NopCloser(buffer)), request.ContentType("application/x-tar"))
c.Assert(err, checker.IsNil)
c.Assert(res.StatusCode, checker.Equals, http.StatusOK)