mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
refactor and fix tests
This commit is contained in:
parent
228091c79e
commit
8291f00a0e
2 changed files with 14 additions and 12 deletions
20
api.go
20
api.go
|
@ -905,15 +905,17 @@ func postBuild(srv *Server, version float64, w http.ResponseWriter, r *http.Requ
|
||||||
if version < 1.3 {
|
if version < 1.3 {
|
||||||
return fmt.Errorf("Multipart upload for build is no longer supported. Please upgrade your docker client.")
|
return fmt.Errorf("Multipart upload for build is no longer supported. Please upgrade your docker client.")
|
||||||
}
|
}
|
||||||
remoteURL := r.FormValue("remote")
|
var (
|
||||||
repoName := r.FormValue("t")
|
remoteURL = r.FormValue("remote")
|
||||||
rawSuppressOutput := r.FormValue("q")
|
repoName = r.FormValue("t")
|
||||||
rawNoCache := r.FormValue("nocache")
|
rawSuppressOutput = r.FormValue("q")
|
||||||
rawRm := r.FormValue("rm")
|
rawNoCache = r.FormValue("nocache")
|
||||||
repoName, tag := utils.ParseRepositoryTag(repoName)
|
rawRm = r.FormValue("rm")
|
||||||
|
authEncoded = r.Header.Get("X-Registry-Auth")
|
||||||
authEncoded := r.Header.Get("X-Registry-Auth")
|
authConfig = &auth.AuthConfig{}
|
||||||
authConfig := &auth.AuthConfig{}
|
tag string
|
||||||
|
)
|
||||||
|
repoName, tag = utils.ParseRepositoryTag(repoName)
|
||||||
if authEncoded != "" {
|
if authEncoded != "" {
|
||||||
authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
|
authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
|
||||||
if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
|
if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
|
||||||
|
|
|
@ -266,7 +266,7 @@ func buildImage(context testContextTemplate, t *testing.T, eng *engine.Engine, u
|
||||||
}
|
}
|
||||||
dockerfile := constructDockerfile(context.dockerfile, ip, port)
|
dockerfile := constructDockerfile(context.dockerfile, ip, port)
|
||||||
|
|
||||||
buildfile := docker.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, useCache, false, ioutil.Discard, utils.NewStreamFormatter(false))
|
buildfile := docker.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, useCache, false, ioutil.Discard, utils.NewStreamFormatter(false), nil)
|
||||||
id, err := buildfile.Build(mkTestContext(dockerfile, context.files, t))
|
id, err := buildfile.Build(mkTestContext(dockerfile, context.files, t))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -516,7 +516,7 @@ func TestForbiddenContextPath(t *testing.T) {
|
||||||
}
|
}
|
||||||
dockerfile := constructDockerfile(context.dockerfile, ip, port)
|
dockerfile := constructDockerfile(context.dockerfile, ip, port)
|
||||||
|
|
||||||
buildfile := docker.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false))
|
buildfile := docker.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false), nil)
|
||||||
_, err = buildfile.Build(mkTestContext(dockerfile, context.files, t))
|
_, err = buildfile.Build(mkTestContext(dockerfile, context.files, t))
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -562,7 +562,7 @@ func TestBuildADDFileNotFound(t *testing.T) {
|
||||||
}
|
}
|
||||||
dockerfile := constructDockerfile(context.dockerfile, ip, port)
|
dockerfile := constructDockerfile(context.dockerfile, ip, port)
|
||||||
|
|
||||||
buildfile := docker.NewBuildFile(mkServerFromEngine(eng, t), ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false))
|
buildfile := docker.NewBuildFile(mkServerFromEngine(eng, t), ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false), nil)
|
||||||
_, err = buildfile.Build(mkTestContext(dockerfile, context.files, t))
|
_, err = buildfile.Build(mkTestContext(dockerfile, context.files, t))
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue