From 26007db650c97926e7e9381fe246c9efab3e18b1 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 15 Apr 2021 16:20:40 -0400 Subject: [PATCH] manually add msrc as an observed distro Signed-off-by: Alfredo Deza --- syft/distro/identify_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/syft/distro/identify_test.go b/syft/distro/identify_test.go index d0d4470ee..f11d74693 100644 --- a/syft/distro/identify_test.go +++ b/syft/distro/identify_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/anchore/syft/internal" + "github.com/stretchr/testify/assert" "github.com/anchore/syft/syft/source" ) @@ -88,10 +89,15 @@ func TestIdentifyDistro(t *testing.T) { observedDistros := internal.NewStringSet() definedDistros := internal.NewStringSet() + for _, distroType := range All { definedDistros.Add(string(distroType)) } + // Somewhat cheating with Windows. There is no support for detecting/parsing a Windows OS, so it is not + // possible to comply with this test unless it is added manually to the "observed distros" + definedDistros.Remove(string(Windows)) + for _, test := range tests { t.Run(test.fixture, func(t *testing.T) { s, err := source.NewFromDirectory(test.fixture) @@ -129,9 +135,7 @@ func TestIdentifyDistro(t *testing.T) { return } - if d.Version.String() != test.Version { - t.Errorf("expected distro version doesn't match: %v != %v", d.Version.String(), test.Version) - } + assert.Equal(t, d.Version.String(), test.Version) }) } @@ -145,7 +149,6 @@ func TestIdentifyDistro(t *testing.T) { } t.Errorf("distro coverage incomplete (defined=%d, coverage=%d)", len(definedDistros), len(observedDistros)) } - } func TestParseOsRelease(t *testing.T) {