mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Update integration tests for server pkg
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
5239aa1f11
commit
8cf0b80a78
3 changed files with 12 additions and 12 deletions
|
@ -2,11 +2,11 @@ package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/dotcloud/docker"
|
|
||||||
"github.com/dotcloud/docker/archive"
|
"github.com/dotcloud/docker/archive"
|
||||||
"github.com/dotcloud/docker/engine"
|
"github.com/dotcloud/docker/engine"
|
||||||
"github.com/dotcloud/docker/image"
|
"github.com/dotcloud/docker/image"
|
||||||
"github.com/dotcloud/docker/nat"
|
"github.com/dotcloud/docker/nat"
|
||||||
|
"github.com/dotcloud/docker/server"
|
||||||
"github.com/dotcloud/docker/utils"
|
"github.com/dotcloud/docker/utils"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
|
@ -384,7 +384,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), nil, nil)
|
buildfile := server.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, useCache, false, ioutil.Discard, utils.NewStreamFormatter(false), nil, nil)
|
||||||
id, err := buildfile.Build(context.Archive(dockerfile, t))
|
id, err := buildfile.Build(context.Archive(dockerfile, t))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -799,7 +799,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), nil, nil)
|
buildfile := server.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false), nil, nil)
|
||||||
_, err = buildfile.Build(context.Archive(dockerfile, t))
|
_, err = buildfile.Build(context.Archive(dockerfile, t))
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -845,7 +845,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), nil, nil)
|
buildfile := server.NewBuildFile(mkServerFromEngine(eng, t), ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false), nil, nil)
|
||||||
_, err = buildfile.Build(context.Archive(dockerfile, t))
|
_, err = buildfile.Build(context.Archive(dockerfile, t))
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -917,8 +917,8 @@ func TestBuildFails(t *testing.T) {
|
||||||
func TestBuildFailsDockerfileEmpty(t *testing.T) {
|
func TestBuildFailsDockerfileEmpty(t *testing.T) {
|
||||||
_, err := buildImage(testContextTemplate{``, nil, nil}, t, nil, true)
|
_, err := buildImage(testContextTemplate{``, nil, nil}, t, nil, true)
|
||||||
|
|
||||||
if err != docker.ErrDockerfileEmpty {
|
if err != server.ErrDockerfileEmpty {
|
||||||
t.Fatal("Expected: %v, got: %v", docker.ErrDockerfileEmpty, err)
|
t.Fatal("Expected: %v, got: %v", server.ErrDockerfileEmpty, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package docker
|
package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/dotcloud/docker"
|
|
||||||
"github.com/dotcloud/docker/engine"
|
"github.com/dotcloud/docker/engine"
|
||||||
"github.com/dotcloud/docker/runconfig"
|
"github.com/dotcloud/docker/runconfig"
|
||||||
|
"github.com/dotcloud/docker/server"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -739,7 +739,7 @@ func TestListContainers(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func assertContainerList(srv *docker.Server, all bool, limit int, since, before string, expected []string) bool {
|
func assertContainerList(srv *server.Server, all bool, limit int, since, before string, expected []string) bool {
|
||||||
job := srv.Eng.Job("containers")
|
job := srv.Eng.Job("containers")
|
||||||
job.SetenvBool("all", all)
|
job.SetenvBool("all", all)
|
||||||
job.SetenvInt("limit", limit)
|
job.SetenvInt("limit", limit)
|
||||||
|
|
|
@ -14,11 +14,11 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/dotcloud/docker"
|
|
||||||
"github.com/dotcloud/docker/builtins"
|
"github.com/dotcloud/docker/builtins"
|
||||||
"github.com/dotcloud/docker/engine"
|
"github.com/dotcloud/docker/engine"
|
||||||
"github.com/dotcloud/docker/runconfig"
|
"github.com/dotcloud/docker/runconfig"
|
||||||
"github.com/dotcloud/docker/runtime"
|
"github.com/dotcloud/docker/runtime"
|
||||||
|
"github.com/dotcloud/docker/server"
|
||||||
"github.com/dotcloud/docker/utils"
|
"github.com/dotcloud/docker/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -149,14 +149,14 @@ func getContainer(eng *engine.Engine, id string, t utils.Fataler) *runtime.Conta
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func mkServerFromEngine(eng *engine.Engine, t utils.Fataler) *docker.Server {
|
func mkServerFromEngine(eng *engine.Engine, t utils.Fataler) *server.Server {
|
||||||
iSrv := eng.Hack_GetGlobalVar("httpapi.server")
|
iSrv := eng.Hack_GetGlobalVar("httpapi.server")
|
||||||
if iSrv == nil {
|
if iSrv == nil {
|
||||||
panic("Legacy server field not set in engine")
|
panic("Legacy server field not set in engine")
|
||||||
}
|
}
|
||||||
srv, ok := iSrv.(*docker.Server)
|
srv, ok := iSrv.(*server.Server)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic("Legacy server field in engine does not cast to *docker.Server")
|
panic("Legacy server field in engine does not cast to *server.Server")
|
||||||
}
|
}
|
||||||
return srv
|
return srv
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue