rm deplicate test helper

This commit is contained in:
Alex Goodman 2019-10-08 09:41:10 -04:00
parent c83bc9e3d0
commit a978266adf
No known key found for this signature in database
GPG key ID: 98AF011C5C78EB7E

View file

@ -1,28 +1,9 @@
package docker
import (
"github.com/wagoodman/dive/dive/image"
"testing"
)
func analysisFromImageTar(t *testing.T, path string) *image.AnalysisResult {
archive, err := TestLoadArchive(path)
if err != nil {
t.Fatalf("unable to fetch archive: %v", err)
}
img, err := archive.ToImage()
if err != nil {
t.Fatalf("unable to convert to image: %v", err)
}
result, err := img.Analyze()
if err != nil {
t.Fatalf("unable to analyze: %v", err)
}
return result
}
func Test_Analysis(t *testing.T) {
table := map[string]struct {
@ -37,7 +18,7 @@ func Test_Analysis(t *testing.T) {
}
for name, test := range table {
result := analysisFromImageTar(t, test.path)
result := TestAnalysisFromArchive(t, test.path)
if result.SizeBytes != test.sizeBytes {
t.Errorf("%s.%s: expected sizeBytes=%v, got %v", t.Name(), name, test.sizeBytes, result.SizeBytes)
@ -59,5 +40,4 @@ func Test_Analysis(t *testing.T) {
t.Errorf("%s.%s: expected efficiency=%v, got %v", t.Name(), name, test.efficiency, result.Efficiency)
}
}
}