mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 06:56:40 +01:00
feat: report unknowns in sbom (#2998)
Signed-off-by: Keith Zantow <kzantow@gmail.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
co-authored by
Alex Goodman
parent
4d7ed9f749
commit
ccbee94b87
@@ -0,0 +1,39 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_Unknowns(t *testing.T) {
|
||||
unknownsImage := getFixtureImage(t, "image-unknowns")
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
args []string
|
||||
env map[string]string
|
||||
assertions []traitAssertion
|
||||
}{
|
||||
{
|
||||
name: "unknown executables",
|
||||
args: []string{"scan", "-o", "json", unknownsImage, "--from", "docker-archive"},
|
||||
env: map[string]string{"SYFT_FORMAT_PRETTY": "true"},
|
||||
assertions: []traitAssertion{
|
||||
assertJsonReport,
|
||||
assertInOutput(`no package identified in executable file`),
|
||||
assertInOutput(`unable to read files from java archive`),
|
||||
assertInOutput(`no package identified in archive`),
|
||||
assertSuccessfulReturnCode,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
cmd, stdout, stderr := runSyft(t, test.env, test.args...)
|
||||
for _, traitFn := range test.assertions {
|
||||
traitFn(t, stdout, stderr, cmd.ProcessState.ExitCode())
|
||||
}
|
||||
logOutputOnFailure(t, cmd, stdout, stderr)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user