rename scope to source

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2020-11-17 12:37:11 -05:00
parent 495fb0a45f
commit 9668341a14
55 changed files with 340 additions and 334 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ import (
"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/anchore/syft/syft/source"
"github.com/go-test/deep"
)
@@ -16,7 +16,7 @@ func TestDistroImage(t *testing.T) {
tarPath := imagetest.GetFixtureImageTarPath(t, fixtureImageName)
defer cleanup()
_, _, actualDistro, err := syft.Catalog("docker-archive:"+tarPath, scope.AllLayersScope)
_, _, actualDistro, err := syft.Catalog("docker-archive:"+tarPath, source.AllLayersScope)
if err != nil {
t.Fatalf("failed to catalog image: %+v", err)
}
+2 -2
View File
@@ -8,7 +8,7 @@ import (
"github.com/anchore/syft/syft"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/presenter/json"
"github.com/anchore/syft/syft/scope"
"github.com/anchore/syft/syft/source"
"github.com/go-test/deep"
)
@@ -31,7 +31,7 @@ func TestCatalogFromJSON(t *testing.T) {
tarPath := imagetest.GetFixtureImageTarPath(t, test.fixture)
defer cleanup()
expectedCatalog, s, expectedDistro, err := syft.Catalog("docker-archive:"+tarPath, scope.AllLayersScope)
expectedCatalog, s, expectedDistro, err := syft.Catalog("docker-archive:"+tarPath, source.AllLayersScope)
if err != nil {
t.Fatalf("failed to catalog image: %+v", err)
}
+5 -5
View File
@@ -15,7 +15,7 @@ import (
"github.com/anchore/syft/syft/distro"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/presenter"
"github.com/anchore/syft/syft/scope"
"github.com/anchore/syft/syft/source"
"github.com/xeipuuv/gojsonschema"
)
@@ -53,7 +53,7 @@ func validateAgainstV1Schema(t *testing.T, json string) {
}
}
func testJsonSchema(t *testing.T, catalog *pkg.Catalog, theScope *scope.Scope, prefix string) {
func testJsonSchema(t *testing.T, catalog *pkg.Catalog, theScope *source.Source, prefix string) {
// make the json output example dir if it does not exist
absJsonSchemaExamplesPath := path.Join(repoRoot(t), jsonSchemaExamplesPath)
if _, err := os.Stat(absJsonSchemaExamplesPath); os.IsNotExist(err) {
@@ -101,7 +101,7 @@ func TestJsonSchemaImg(t *testing.T) {
tarPath := imagetest.GetFixtureImageTarPath(t, fixtureImageName)
defer cleanup()
catalog, theScope, _, err := syft.Catalog("docker-archive:"+tarPath, scope.AllLayersScope)
catalog, theScope, _, err := syft.Catalog("docker-archive:"+tarPath, source.AllLayersScope)
if err != nil {
t.Fatalf("failed to catalog image: %+v", err)
}
@@ -118,9 +118,9 @@ func TestJsonSchemaImg(t *testing.T) {
}
func TestJsonSchemaDirs(t *testing.T) {
catalog, theScope, _, err := syft.Catalog("dir:test-fixtures/image-pkg-coverage", scope.AllLayersScope)
catalog, theScope, _, err := syft.Catalog("dir:test-fixtures/image-pkg-coverage", source.AllLayersScope)
if err != nil {
t.Errorf("unable to create scope from dir: %+v", err)
t.Errorf("unable to create source from dir: %+v", err)
}
var cases []testCase
+4 -4
View File
@@ -9,7 +9,7 @@ import (
"github.com/anchore/syft/internal"
"github.com/anchore/syft/syft"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/scope"
"github.com/anchore/syft/syft/source"
)
func TestPkgCoverageImage(t *testing.T) {
@@ -18,7 +18,7 @@ func TestPkgCoverageImage(t *testing.T) {
tarPath := imagetest.GetFixtureImageTarPath(t, fixtureImageName)
defer cleanup()
catalog, _, _, err := syft.Catalog("docker-archive:"+tarPath, scope.AllLayersScope)
catalog, _, _, err := syft.Catalog("docker-archive:"+tarPath, source.AllLayersScope)
if err != nil {
t.Fatalf("failed to catalog image: %+v", err)
}
@@ -100,10 +100,10 @@ func TestPkgCoverageImage(t *testing.T) {
}
func TestPkgCoverageDirectory(t *testing.T) {
catalog, _, _, err := syft.Catalog("dir:test-fixtures/image-pkg-coverage", scope.AllLayersScope)
catalog, _, _, err := syft.Catalog("dir:test-fixtures/image-pkg-coverage", source.AllLayersScope)
if err != nil {
t.Errorf("unable to create scope from dir: %+v", err)
t.Errorf("unable to create source from dir: %+v", err)
}
observedLanguages := internal.NewStringSet()
+2 -2
View File
@@ -9,7 +9,7 @@ import (
"github.com/anchore/stereoscope/pkg/imagetest"
"github.com/anchore/syft/syft"
"github.com/anchore/syft/syft/scope"
"github.com/anchore/syft/syft/source"
)
func TestRegression212ApkBufferSize(t *testing.T) {
@@ -21,7 +21,7 @@ func TestRegression212ApkBufferSize(t *testing.T) {
tarPath := imagetest.GetFixtureImageTarPath(t, fixtureImageName)
defer cleanup()
catalog, _, _, err := syft.Catalog("docker-archive:"+tarPath, scope.SquashedScope)
catalog, _, _, err := syft.Catalog("docker-archive:"+tarPath, source.SquashedScope)
if err != nil {
t.Fatalf("failed to catalog image: %+v", err)
}