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.
This commit is contained in:
Ian Delahorne 2014-06-30 09:07:36 -05:00
parent 29d8bb605c
commit 2d1e1cc83e
1 changed files with 2 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"github.com/mitchellh/goamz/ec2"
"github.com/mitchellh/packer/packer"
"log"
"sort"
"strings"
)
@ -46,6 +47,7 @@ func (a *Artifact) String() string {
amiStrings = append(amiStrings, single)
}
sort.Sort(sort.StringSlice(amiStrings))
return fmt.Sprintf("AMIs were created:\n\n%s", strings.Join(amiStrings, "\n"))
}