mirror of
https://github.com/anchore/syft.git
synced 2026-10-30 14:02:26 +01:00
Add platform selection (#866)
This commit is contained in:
@@ -184,6 +184,14 @@ func TestPackagesCmdFlags(t *testing.T) {
|
||||
assertInOutput("search-indexed-archives: false"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "platform-option-wired-up",
|
||||
args: []string{"packages", "--platform", "arm64", "-o", "json", "registry:busybox:1.31"},
|
||||
assertions: []traitAssertion{
|
||||
assertInOutput("sha256:1ee006886991ad4689838d3a288e0dd3fd29b70e276622f16b67a8922831a853"), // linux/arm64 image digest
|
||||
assertSuccessfulReturnCode,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
||||
@@ -24,7 +24,7 @@ func BenchmarkImagePackageCatalogers(b *testing.B) {
|
||||
for _, c := range cataloger.ImageCatalogers(cataloger.DefaultConfig()) {
|
||||
// in case of future alteration where state is persisted, assume no dependency is safe to reuse
|
||||
userInput := "docker-archive:" + tarPath
|
||||
sourceInput, err := source.ParseInput(userInput, false)
|
||||
sourceInput, err := source.ParseInput(userInput, "", false)
|
||||
require.NoError(b, err)
|
||||
theSource, cleanupSource, err := source.New(*sourceInput, nil, nil)
|
||||
b.Cleanup(cleanupSource)
|
||||
|
||||
@@ -17,7 +17,7 @@ func catalogFixtureImage(t *testing.T, fixtureImageName string) (sbom.SBOM, *sou
|
||||
imagetest.GetFixtureImage(t, "docker-archive", fixtureImageName)
|
||||
tarPath := imagetest.GetFixtureImageTarPath(t, fixtureImageName)
|
||||
userInput := "docker-archive:" + tarPath
|
||||
sourceInput, err := source.ParseInput(userInput, false)
|
||||
sourceInput, err := source.ParseInput(userInput, "", false)
|
||||
require.NoError(t, err)
|
||||
theSource, cleanupSource, err := source.New(*sourceInput, nil, nil)
|
||||
t.Cleanup(cleanupSource)
|
||||
@@ -52,7 +52,7 @@ func catalogFixtureImage(t *testing.T, fixtureImageName string) (sbom.SBOM, *sou
|
||||
|
||||
func catalogDirectory(t *testing.T, dir string) (sbom.SBOM, *source.Source) {
|
||||
userInput := "dir:" + dir
|
||||
sourceInput, err := source.ParseInput(userInput, false)
|
||||
sourceInput, err := source.ParseInput(userInput, "", false)
|
||||
require.NoError(t, err)
|
||||
theSource, cleanupSource, err := source.New(*sourceInput, nil, nil)
|
||||
t.Cleanup(cleanupSource)
|
||||
|
||||
Reference in New Issue
Block a user