mirror of
https://github.com/anchore/syft.git
synced 2026-11-02 15:36:41 +01:00
Add support for Arch (which doesnt return a version) and Open Suse Leap
Signed-off-by: Samuel Dacanay <sam.dacanay@anchore.com> remove bad-version test fixture (no longer relevant since it is now an expected case) and add cases for arch and opensuse-leap Signed-off-by: Samuel Dacanay <sam.dacanay@anchore.com> Reduce nesting, simplify empty version logic Signed-off-by: Samuel Dacanay <sam.dacanay@anchore.com>
This commit is contained in:
@@ -65,6 +65,15 @@ func TestIdentifyDistro(t *testing.T) {
|
||||
fixture: "test-fixtures/os/unmatchable",
|
||||
Type: UnknownDistroType,
|
||||
},
|
||||
{
|
||||
fixture: "test-fixtures/os/opensuse-leap",
|
||||
Type: OpenSuseLeap,
|
||||
Version: "15.2.0",
|
||||
},
|
||||
{
|
||||
fixture: "test-fixtures/os/arch",
|
||||
Type: ArchLinux,
|
||||
},
|
||||
}
|
||||
|
||||
observedDistros := internal.NewStringSet()
|
||||
@@ -94,6 +103,11 @@ func TestIdentifyDistro(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
if d.Version == nil {
|
||||
t.Log("Distro doesn't have a Version")
|
||||
return
|
||||
}
|
||||
|
||||
if d.Version.String() != test.Version {
|
||||
t.Errorf("expected distro version doesn't match: %v != %v", d.Version.String(), test.Version)
|
||||
}
|
||||
@@ -175,10 +189,6 @@ func TestParseOsReleaseFailures(t *testing.T) {
|
||||
fixture string
|
||||
name string
|
||||
}{
|
||||
{
|
||||
fixture: "test-fixtures/bad-version",
|
||||
name: "No version",
|
||||
},
|
||||
{
|
||||
fixture: "test-fixtures/bad-id",
|
||||
name: "No name ID",
|
||||
|
||||
Reference in New Issue
Block a user