mirror of
https://github.com/anchore/syft.git
synced 2026-11-02 07:26:34 +01:00
Add ability to scan snaps (as a source) (#3929)
This commit is contained in:
@@ -145,6 +145,51 @@ func TestSource_UnmarshalJSON(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "snap",
|
||||
input: []byte(`{
|
||||
"id": "foobar",
|
||||
"name": "etcd",
|
||||
"version": "3.4.36",
|
||||
"type": "snap",
|
||||
"metadata": {
|
||||
"summary": "Distributed reliable key-value store",
|
||||
"base": "core18",
|
||||
"grade": "stable",
|
||||
"confinement": "strict",
|
||||
"architectures": [
|
||||
"amd64"
|
||||
],
|
||||
"digests": [
|
||||
{
|
||||
"algorithm": "sha256",
|
||||
"value": "6700d789d2c38b0f7513058ddcea8f9a275e2206b4621a772eb065e12069956e"
|
||||
}
|
||||
]
|
||||
}
|
||||
}`),
|
||||
expected: &Source{
|
||||
ID: "foobar",
|
||||
Name: "etcd",
|
||||
Version: "3.4.36",
|
||||
Type: "snap",
|
||||
Metadata: source.SnapMetadata{
|
||||
Summary: "Distributed reliable key-value store",
|
||||
Base: "core18",
|
||||
Grade: "stable",
|
||||
Confinement: "strict",
|
||||
Architectures: []string{
|
||||
"amd64",
|
||||
},
|
||||
Digests: []file.Digest{
|
||||
{
|
||||
Algorithm: "sha256",
|
||||
Value: "6700d789d2c38b0f7513058ddcea8f9a275e2206b4621a772eb065e12069956e",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "unknown source type",
|
||||
input: []byte(`{
|
||||
|
||||
Reference in New Issue
Block a user