mirror of
https://github.com/anchore/syft
synced 2024-09-20 06:01:53 +00:00
cc731c7b19
* add kernel handler Signed-off-by: Avi Deitcher <avi@deitcher.net> * [wip] combine kernel and kernel module cataloging Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * [wip] combine kernel and kernel module cataloging Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Signed-off-by: Avi Deitcher <avi@deitcher.net> * rename Kernel package to LinuxKernel package Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * split kernel and module packages within cataloger Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * wire up application configuration with kernel cataloger options Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * dont use references for packages on relationships Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * fix linting and tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * kernel cataloger should be resistent to partial failure Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * log upon kernel module metadata missing Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add tests for linux kernel cataloger Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update integration tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update cli package test counts Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add evidence annotations for kernel packages Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * reduce noise in cli test output Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * missed cli test to reduce noise for Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * fix package counts Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update docs with linux kernel cataloging refs Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * bump json schema with new metadata fields Signed-off-by: Alex Goodman <alex.goodman@anchore.com> --------- Signed-off-by: Avi Deitcher <avi@deitcher.net> Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Signed-off-by: <> Co-authored-by: Alex Goodman <alex.goodman@anchore.com>
39 lines
1,013 B
Go
39 lines
1,013 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/anchore/syft/syft/formats"
|
|
"github.com/anchore/syft/syft/formats/template"
|
|
)
|
|
|
|
func TestAllFormatsExpressible(t *testing.T) {
|
|
commonAssertions := []traitAssertion{
|
|
func(tb testing.TB, stdout, _ string, _ int) {
|
|
tb.Helper()
|
|
if len(stdout) < 1000 {
|
|
tb.Errorf("there may not be any report output (len=%d)", len(stdout))
|
|
}
|
|
},
|
|
assertSuccessfulReturnCode,
|
|
}
|
|
formatNames := formats.AllIDs()
|
|
require.NotEmpty(t, formatNames)
|
|
for _, o := range formatNames {
|
|
t.Run(fmt.Sprintf("format:%s", o), func(t *testing.T) {
|
|
args := []string{"dir:./test-fixtures/image-pkg-coverage", "-o", string(o)}
|
|
if o == template.ID {
|
|
args = append(args, "-t", "test-fixtures/csv.template")
|
|
}
|
|
|
|
cmd, stdout, stderr := runSyft(t, nil, args...)
|
|
for _, traitFn := range commonAssertions {
|
|
traitFn(t, stdout, stderr, cmd.ProcessState.ExitCode())
|
|
}
|
|
logOutputOnFailure(t, cmd, stdout, stderr)
|
|
})
|
|
}
|
|
}
|