From 7898dca8b3d1835d15812bd5249fcfb0de73257b Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 14 Jan 2014 11:43:58 -0800 Subject: [PATCH] fix tests & small code improvment Docker-DCO-1.1-Signed-off-by: Victor Vieux (github: vieux) --- api_params.go | 8 -------- integration/api_test.go | 8 ++++---- server.go | 6 +++--- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/api_params.go b/api_params.go index cfe80c8b0b..92dde2906a 100644 --- a/api_params.go +++ b/api_params.go @@ -1,14 +1,6 @@ package docker type ( - APIHistory struct { - ID string `json:"Id"` - Tags []string `json:",omitempty"` - Created int64 - CreatedBy string `json:",omitempty"` - Size int64 - } - APITop struct { Titles []string Processes [][]string diff --git a/integration/api_test.go b/integration/api_test.go index 47d63efb1d..3c807aecd7 100644 --- a/integration/api_test.go +++ b/integration/api_test.go @@ -263,12 +263,12 @@ func TestGetImagesHistory(t *testing.T) { } assertHttpNotError(r, t) - history := []docker.APIHistory{} - if err := json.Unmarshal(r.Body.Bytes(), &history); err != nil { + outs := engine.NewTable("Created", 0) + if _, err := outs.ReadFrom(r.Body); err != nil { t.Fatal(err) } - if len(history) != 1 { - t.Errorf("Expected 1 line, %d found", len(history)) + if len(outs.Data) != 1 { + t.Errorf("Expected 1 line, %d found", len(outs.Data)) } } diff --git a/server.go b/server.go index ce0b3f91c5..2a56d5f439 100644 --- a/server.go +++ b/server.go @@ -587,7 +587,7 @@ func (srv *Server) Images(job *engine.Job) engine.Status { allImages, err = srv.runtime.graph.Heads() } if err != nil { - job.Errorf("%s", err) + job.Error(err) return engine.StatusErr } lookup := make(map[string]*engine.Env) @@ -642,7 +642,7 @@ func (srv *Server) Images(job *engine.Job) engine.Status { outs.ReverseSort() if _, err := outs.WriteTo(job.Stdout); err != nil { - job.Errorf("%s", err) + job.Error(err) return engine.StatusErr } return engine.StatusOK @@ -735,7 +735,7 @@ func (srv *Server) ImageHistory(job *engine.Job) engine.Status { }) outs.ReverseSort() if _, err := outs.WriteTo(job.Stdout); err != nil { - job.Errorf("%s", err) + job.Error(err) return engine.StatusErr } return engine.StatusOK