Fix test case
This commit is contained in:
@@ -452,7 +452,7 @@ type DistroAdvisory struct {
|
||||
type Container struct {
|
||||
ContainerID string
|
||||
Name string
|
||||
Image string
|
||||
Image string
|
||||
}
|
||||
|
||||
// Platform has platform information
|
||||
|
||||
@@ -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{}
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user