mirror of
https://github.com/anchore/syft.git
synced 2026-02-12 02:26:42 +01:00
Signed-off-by: Alan Pope <alan@popey.com> Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com> Co-authored-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
package snap
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/anchore/syft/syft/file"
|
|
"github.com/anchore/syft/syft/pkg"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest"
|
|
)
|
|
|
|
func TestParseSystemManifest(t *testing.T) {
|
|
fixture := "test-fixtures/manifest.yaml"
|
|
locations := file.NewLocationSet(file.NewLocation(fixture))
|
|
|
|
expected := []pkg.Package{
|
|
{
|
|
Name: "grub-efi-amd64-signed",
|
|
Version: "1.202+2.12-1ubuntu7",
|
|
Type: pkg.DebPkg,
|
|
PURL: "pkg:deb/ubuntu/grub-efi-amd64-signed@1.202%2B2.12-1ubuntu7?arch=amd64", // URL encoded
|
|
Locations: locations,
|
|
Metadata: pkg.SnapEntry{
|
|
SnapType: pkg.SnapTypeApp, // Default type when gadget not detected from name
|
|
Base: "core24",
|
|
SnapName: "pc",
|
|
SnapVersion: "24-0.1",
|
|
Architecture: "amd64", // From architectures array
|
|
},
|
|
},
|
|
{
|
|
Name: "shim-signed",
|
|
Version: "1.56+15.7-0ubuntu1",
|
|
Type: pkg.DebPkg,
|
|
PURL: "pkg:deb/ubuntu/shim-signed@1.56%2B15.7-0ubuntu1?arch=amd64", // URL encoded
|
|
Locations: locations,
|
|
Metadata: pkg.SnapEntry{
|
|
SnapType: pkg.SnapTypeApp, // Default type when gadget not detected from name
|
|
Base: "core24",
|
|
SnapName: "pc",
|
|
SnapVersion: "24-0.1",
|
|
Architecture: "amd64", // From architectures array
|
|
},
|
|
},
|
|
}
|
|
|
|
pkgtest.TestFileParser(t, fixture, parseSystemManifest, expected, nil)
|
|
}
|