add symlink content fetching support

This commit is contained in:
Alex Goodman
2020-06-16 11:37:37 -04:00
parent 778754dd59
commit cd94179985
26 changed files with 855 additions and 161 deletions
+35
View File
@@ -0,0 +1,35 @@
// +build integration
package integration
import (
"testing"
"github.com/anchore/go-testutils"
"github.com/anchore/imgbom/imgbom"
"github.com/anchore/imgbom/imgbom/distro"
"github.com/go-test/deep"
)
func TestDistroImage(t *testing.T) {
img, cleanup := testutils.GetFixtureImage(t, "docker-archive", "image-distro-id")
defer cleanup()
actual := imgbom.IdentifyDistro(img)
if actual == nil {
t.Fatalf("could not find distro")
}
expected, err := distro.NewDistro(distro.Busybox, "1.31.1")
if err != nil {
t.Fatalf("could not create distro: %+v", err)
}
diffs := deep.Equal(*actual, expected)
if len(diffs) != 0 {
for _, d := range diffs {
t.Errorf("found distro difference: %+v", d)
}
}
}
@@ -7,6 +7,7 @@ import (
"github.com/anchore/go-testutils"
"github.com/anchore/imgbom/imgbom"
"github.com/anchore/imgbom/imgbom/cataloger"
"github.com/anchore/imgbom/imgbom/pkg"
"github.com/anchore/imgbom/imgbom/scope"
)
@@ -137,4 +138,9 @@ func TestLanguageImage(t *testing.T) {
})
}
// ensure that integration test cases stay in sync with the available catalogers
if len(cataloger.Catalogers()) < len(cases) {
t.Fatalf("probably missed a cataloger during testing, double check that all catalogers are included in testing")
}
}
@@ -0,0 +1,3 @@
FROM busybox:1.31.1