From e16ec15226b27ad49062b00b2fa625cd9e3ce641 Mon Sep 17 00:00:00 2001 From: Kota Kanbe Date: Thu, 16 Feb 2017 11:32:18 +0900 Subject: [PATCH] Fix test case --- models/models.go | 2 +- scan/base.go | 4 ++-- scan/base_test.go | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/models/models.go b/models/models.go index 5d3ed55d..0b19e07a 100644 --- a/models/models.go +++ b/models/models.go @@ -452,7 +452,7 @@ type DistroAdvisory struct { type Container struct { ContainerID string Name string - Image string + Image string } // Platform has platform information diff --git a/scan/base.go b/scan/base.go index d8c91e6a..813b8b06 100644 --- a/scan/base.go +++ b/scan/base.go @@ -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{} diff --git a/scan/base_test.go b/scan/base_test.go index 342df07d..808d5058 100644 --- a/scan/base_test.go +++ b/scan/base_test.go @@ -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", }, }, }