mirror of
https://github.com/anchore/syft.git
synced 2026-10-31 06:26:30 +01:00
Add SPDX support (#445)
* add initial spdx support Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * expose FileOwner and use in SPDX presenter Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add initial json support for SPDX Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add remaining package fields Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add spdx license list generation + tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * keep fileOwner unexported from pkg Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * restore cli test util Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add external refs to spdx tag-value format Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add golang support to CPE generation Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * use tag-value format as default "spdx" format flavor Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add tests around spdx presenters + refactor presenter tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add bouncer exception for spdx tools-golang repo Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * remove spdx model questions Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
@@ -60,18 +60,18 @@ func TestJSONSchema(t *testing.T) {
|
||||
args = append(args, a)
|
||||
}
|
||||
|
||||
_, stdout, _ := runSyftCommand(t, nil, args...)
|
||||
_, stdout, stderr := runSyftCommand(t, nil, args...)
|
||||
|
||||
if len(strings.Trim(stdout, "\n ")) < 100 {
|
||||
t.Fatalf("bad syft output: %q", stdout)
|
||||
t.Fatalf("bad syft run:\noutput: %q\n:error: %q", stdout, stderr)
|
||||
}
|
||||
|
||||
validateAgainstV1Schema(t, stdout)
|
||||
validateJsonAgainstSchema(t, stdout)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func validateAgainstV1Schema(t testing.TB, json string) {
|
||||
func validateJsonAgainstSchema(t testing.TB, json string) {
|
||||
fullSchemaPath := path.Join(repoRoot(t), jsonSchemaPath, fmt.Sprintf("schema-%s.json", internal.JSONSchemaVersion))
|
||||
schemaLoader := gojsonschema.NewReferenceLoader(fmt.Sprintf("file://%s", fullSchemaPath))
|
||||
documentLoader := gojsonschema.NewStringLoader(json)
|
||||
|
||||
Reference in New Issue
Block a user