Fix test case

This commit is contained in:
Kota Kanbe
2017-02-16 11:32:18 +09:00
parent 6935b56c9d
commit e16ec15226
3 changed files with 7 additions and 5 deletions

View File

@@ -452,7 +452,7 @@ type DistroAdvisory struct {
type Container struct {
ContainerID string
Name string
Image string
Image string
}
// Platform has platform information

View File

@@ -172,7 +172,7 @@ func (l *base) parseDockerPs(stdout string) (containers []config.Container, err
containers = append(containers, config.Container{
ContainerID: fields[0],
Name: fields[1],
Image: fields[2],
Image: fields[2],
})
}
return
@@ -279,7 +279,7 @@ func (l *base) convertToModel() models.ScanResult {
container := models.Container{
ContainerID: l.ServerInfo.Container.ContainerID,
Name: l.ServerInfo.Container.Name,
Image: l.ServerInfo.Container.Image,
Image: l.ServerInfo.Container.Image,
}
errs := []string{}

View File

@@ -30,16 +30,18 @@ func TestParseDockerPs(t *testing.T) {
in string
expected []config.Container
}{
`c7ca0992415a romantic_goldberg
f570ae647edc agitated_lovelace`,
`c7ca0992415a romantic_goldberg ubuntu:14.04.5
f570ae647edc agitated_lovelace centos:latest`,
[]config.Container{
{
ContainerID: "c7ca0992415a",
Name: "romantic_goldberg",
Image: "ubuntu:14.04.5",
},
{
ContainerID: "f570ae647edc",
Name: "agitated_lovelace",
Image: "centos:latest",
},
},
}