Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Run tests in parallel, dont use working dir #75

Merged
merged 1 commit into from
Sep 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ func analyzeImage(imageArg string, analyzerArgs []string) error {
outputResults(analyses)

if save {
dir, _ := os.Getwd()
glog.Infof("Image was saved at %s as %s", dir, image.FSPath)
glog.Infof("Image was saved at %s", image.FSPath)
}

return nil
Expand Down
3 changes: 1 addition & 2 deletions cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ func diffImages(image1Arg, image2Arg string, diffArgs []string) error {
outputResults(diffs)

if save {
dir, _ := os.Getwd()
glog.Infof("Images were saved at %s as %s and %s", dir, imageMap[image1Arg].FSPath,
glog.Infof("Images were saved at %s and %s", imageMap[image1Arg].FSPath,
imageMap[image2Arg].FSPath)

}
Expand Down
1 change: 1 addition & 0 deletions tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func TestDiffAndAnalysis(t *testing.T) {
}
for _, test := range tests {
t.Run(test.description, func(t *testing.T) {
t.Parallel()
args := []string{test.subcommand, test.imageA}
if test.imageB != "" {
args = append(args, test.imageB)
Expand Down
12 changes: 7 additions & 5 deletions utils/image_prep_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ func (p CloudPrepper) getFileSystem() (string, error) {
URLPattern := regexp.MustCompile("^.+/(.+(:.+){0,1})$")
URLMatch := URLPattern.FindStringSubmatch(p.Source)
// Removing the ":" so that the image path name can be <image><tag>
path := strings.Replace(URLMatch[1], ":", "", -1)
sanitizedName := strings.Replace(URLMatch[1], ":", "", -1)

path, err := ioutil.TempDir("", sanitizedName)
if err != nil {
return "", err
}

ref, err := docker.ParseReference("//" + p.Source)
if err != nil {
return "", err
Expand Down Expand Up @@ -156,10 +162,6 @@ func (p CloudPrepper) getFileSystem() (string, error) {
return "", err
}

if _, ok := os.Stat(path); ok != nil {
os.MkdirAll(path, 0777)
}

for _, b := range img.LayerInfos() {
bi, _, err := imgSrc.GetBlob(b)
if err != nil {
Expand Down