mirror of
https://github.com/anchore/syft.git
synced 2026-10-31 06:26:30 +01:00
pull in temp dir generator from stereoscope
Signed-off-by: Alex Goodman <wagoodman@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/anchore/syft/syft/distro"
|
||||
@@ -24,7 +25,9 @@ func BenchmarkImagePackageCatalogers(b *testing.B) {
|
||||
for _, c := range cataloger.ImageCatalogers() {
|
||||
// in case of future alteration where state is persisted, assume no dependency is safe to reuse
|
||||
theSource, cleanupSource, err := source.New("docker-archive:"+tarPath, nil)
|
||||
b.Cleanup(cleanupSource)
|
||||
b.Cleanup(func() {
|
||||
assert.NoError(b, cleanupSource())
|
||||
})
|
||||
if err != nil {
|
||||
b.Fatalf("unable to get source: %+v", err)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/anchore/stereoscope/pkg/imagetest"
|
||||
@@ -15,7 +16,9 @@ func catalogFixtureImage(t *testing.T, fixtureImageName string) (*pkg.Catalog, *
|
||||
tarPath := imagetest.GetFixtureImageTarPath(t, fixtureImageName)
|
||||
|
||||
theSource, cleanupSource, err := source.New("docker-archive:"+tarPath, nil)
|
||||
t.Cleanup(cleanupSource)
|
||||
t.Cleanup(func() {
|
||||
assert.NoError(t, cleanupSource())
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("unable to get source: %+v", err)
|
||||
}
|
||||
@@ -30,7 +33,9 @@ func catalogFixtureImage(t *testing.T, fixtureImageName string) (*pkg.Catalog, *
|
||||
|
||||
func catalogDirectory(t *testing.T, dir string) (*pkg.Catalog, *distro.Distro, source.Source) {
|
||||
theSource, cleanupSource, err := source.New("dir:"+dir, nil)
|
||||
t.Cleanup(cleanupSource)
|
||||
t.Cleanup(func() {
|
||||
assert.NoError(t, cleanupSource())
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("unable to get source: %+v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user