Commit 2d1e1cc8 authored by Ian Delahorne's avatar Ian Delahorne

Sort AMI names in Artifact.String - fixes random test failures

With go tip, the output from Artifact.String will sometimes be output in a
different order than the tests. Sort the AMI strings before outputting.
See https://travis-ci.org/mitchellh/packer/jobs/28748467 for an example of this
failure.
parent 29d8bb60
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"github.com/mitchellh/goamz/ec2" "github.com/mitchellh/goamz/ec2"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"log" "log"
"sort"
"strings" "strings"
) )
...@@ -46,6 +47,7 @@ func (a *Artifact) String() string { ...@@ -46,6 +47,7 @@ func (a *Artifact) String() string {
amiStrings = append(amiStrings, single) amiStrings = append(amiStrings, single)
} }
sort.Sort(sort.StringSlice(amiStrings))
return fmt.Sprintf("AMIs were created:\n\n%s", strings.Join(amiStrings, "\n")) return fmt.Sprintf("AMIs were created:\n\n%s", strings.Join(amiStrings, "\n"))
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment