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:
parent
bea6dd3888
commit
7898dca8b3
3 changed files with 7 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue