1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

fix tests & small code improvment

Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
This commit is contained in:
Victor Vieux 2014-01-14 11:43:58 -08:00
parent bea6dd3888
commit 7898dca8b3
3 changed files with 7 additions and 15 deletions

View file

@ -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

View file

@ -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))
}
}

View file

@ -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