mirror of
https://github.com/anchore/syft
synced 2024-11-13 23:57:07 +00:00
3d91a66536
* add oci support + update image schemes Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update docs to reflect OCI image sources + URI scheme change Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update to oci-dir Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * bump upstream stereoscope pin Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
41 lines
999 B
Go
41 lines
999 B
Go
// +build integration
|
|
|
|
package integration
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/anchore/stereoscope/pkg/imagetest"
|
|
"github.com/anchore/syft/syft"
|
|
"github.com/anchore/syft/syft/distro"
|
|
"github.com/anchore/syft/syft/scope"
|
|
"github.com/go-test/deep"
|
|
)
|
|
|
|
func TestDistroImage(t *testing.T) {
|
|
fixtureImageName := "image-distro-id"
|
|
_, cleanup := imagetest.GetFixtureImage(t, "docker-archive", fixtureImageName)
|
|
tarPath := imagetest.GetFixtureImageTarPath(t, fixtureImageName)
|
|
defer cleanup()
|
|
|
|
_, _, actualDistro, err := syft.Catalog("docker-archive:"+tarPath, scope.AllLayersScope)
|
|
if err != nil {
|
|
t.Fatalf("failed to catalog image: %+v", err)
|
|
}
|
|
if actualDistro == 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(*actualDistro, expected)
|
|
if len(diffs) != 0 {
|
|
for _, d := range diffs {
|
|
t.Errorf("found distro difference: %+v", d)
|
|
}
|
|
}
|
|
|
|
}
|