From fc2f998822699c0c7e22e4fc791d10c3b1ea1e53 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 29 Jan 2014 20:16:47 +0000 Subject: [PATCH] remove some mkServerFromEngine Docker-DCO-1.1-Signed-off-by: Victor Vieux (github: vieux) --- integration/runtime_test.go | 7 ++++--- integration/sorter_test.go | 14 ++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/integration/runtime_test.go b/integration/runtime_test.go index e08643b36d..4fc3c56868 100644 --- a/integration/runtime_test.go +++ b/integration/runtime_test.go @@ -61,7 +61,7 @@ func cleanup(eng *engine.Engine, t *testing.T) error { } for _, image := range images.Data { if image.Get("ID") != unitTestImageID { - mkServerFromEngine(eng, t).DeleteImage(image.Get("ID"), false) + eng.Job("image_delete", image.Get("ID")).Run() } } return nil @@ -132,10 +132,11 @@ func setupBaseImage() { if err := job.Run(); err != nil { log.Fatalf("Unable to create a runtime for tests: %s", err) } - srv := mkServerFromEngine(eng, log.New(os.Stderr, "", 0)) + job = eng.Job("inspect", unitTestImageName, "image") + img, _ := job.Stdout.AddEnv() // If the unit test is not found, try to download it. - if img, err := srv.ImageInspect(unitTestImageName); err != nil || img.ID != unitTestImageID { + if err := job.Run(); err != nil || img.Get("id") != unitTestImageID { // Retrieve the Image job = eng.Job("pull", unitTestImageName) job.Stdout.Add(utils.NopWriteCloser(os.Stdout)) diff --git a/integration/sorter_test.go b/integration/sorter_test.go index d193fca1f0..3ce1225ca4 100644 --- a/integration/sorter_test.go +++ b/integration/sorter_test.go @@ -1,7 +1,7 @@ package docker import ( - "github.com/dotcloud/docker" + "github.com/dotcloud/docker/engine" "testing" "time" ) @@ -9,9 +9,8 @@ import ( func TestServerListOrderedImagesByCreationDate(t *testing.T) { eng := NewTestEngine(t) defer mkRuntimeFromEngine(eng, t).Nuke() - srv := mkServerFromEngine(eng, t) - if err := generateImage("", srv); err != nil { + if err := generateImage("", eng); err != nil { t.Fatal(err) } @@ -25,16 +24,15 @@ func TestServerListOrderedImagesByCreationDate(t *testing.T) { func TestServerListOrderedImagesByCreationDateAndTag(t *testing.T) { eng := NewTestEngine(t) defer mkRuntimeFromEngine(eng, t).Nuke() - srv := mkServerFromEngine(eng, t) - err := generateImage("bar", srv) + err := generateImage("bar", eng) if err != nil { t.Fatal(err) } time.Sleep(time.Second) - err = generateImage("zed", srv) + err = generateImage("zed", eng) if err != nil { t.Fatal(err) } @@ -46,12 +44,12 @@ func TestServerListOrderedImagesByCreationDateAndTag(t *testing.T) { } } -func generateImage(name string, srv *docker.Server) error { +func generateImage(name string, eng *engine.Engine) error { archive, err := fakeTar() if err != nil { return err } - job := srv.Eng.Job("import", "-", "repo", name) + job := eng.Job("import", "-", "repo", name) job.Stdin.Add(archive) job.SetenvBool("json", true) return job.Run()