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.
pull/1305/head
Ian Delahorne 12 years ago
parent 29d8bb605c
commit 2d1e1cc83e

@ -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"))
}

Loading…
Cancel
Save