Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
Jess Frazelle 2018-09-24 23:03:13 -04:00
parent 81851b276b
commit 7b1564a6a1
No known key found for this signature in database
GPG key ID: 18F3685C0022BFF3
2 changed files with 7 additions and 1 deletions

View file

@ -87,6 +87,11 @@ func (cmd *vulnsCommand) Run(ctx context.Context, args []string) error {
} }
} }
if len(report.VulnsBySeverity) < 1 {
fmt.Println("No vulnerabilies found.")
return nil
}
// Print summary and count. // Print summary and count.
for sev, vulns := range report.VulnsBySeverity { for sev, vulns := range report.VulnsBySeverity {
fmt.Printf("%s: %d\n", sev, len(vulns)) fmt.Printf("%s: %d\n", sev, len(vulns))

View file

@ -12,7 +12,8 @@ func TestVulns(t *testing.T) {
t.Fatalf("output: %s, error: %v", out, err) t.Fatalf("output: %s, error: %v", out, err)
} }
expected := `clair.clair resp.Status=200 OK` expected := `clair.clair resp.Status=200 OK
No vulnerabilies found.`
if !strings.HasSuffix(strings.TrimSpace(out), expected) { if !strings.HasSuffix(strings.TrimSpace(out), expected) {
t.Fatalf("expected: %s\ngot: %s", expected, out) t.Fatalf("expected: %s\ngot: %s", expected, out)
} }