builder/amazonebs: Artifact ID works
This commit is contained in:
parent
0f0041725e
commit
227ab55617
|
@ -25,9 +25,13 @@ func (*artifact) Files() []string {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (*artifact) Id() string {
|
||||
// TODO(mitchellh): Id
|
||||
return "TODO"
|
||||
func (a *artifact) Id() string {
|
||||
parts := make([]string, 0, len(a.amis))
|
||||
for region, amiId := range a.amis {
|
||||
parts = append(parts, fmt.Sprintf("%s:%s", region, amiId))
|
||||
}
|
||||
|
||||
return strings.Join(parts, ",")
|
||||
}
|
||||
|
||||
func (a *artifact) String() string {
|
||||
|
|
|
@ -13,6 +13,20 @@ func TestArtifact_Impl(t *testing.T) {
|
|||
assert.Implementor(&artifact{}, &actual, "should be an Artifact")
|
||||
}
|
||||
|
||||
func TestArtifactId(t *testing.T) {
|
||||
assert := asserts.NewTestingAsserts(t, true)
|
||||
|
||||
expected := `east:foo,west:bar`
|
||||
|
||||
amis := make(map[string]string)
|
||||
amis["east"] = "foo"
|
||||
amis["west"] = "bar"
|
||||
|
||||
a := &artifact{amis, nil}
|
||||
result := a.Id()
|
||||
assert.Equal(result, expected, "should match output")
|
||||
}
|
||||
|
||||
func TestArtifactString(t *testing.T) {
|
||||
assert := asserts.NewTestingAsserts(t, true)
|
||||
|
||||
|
|
Loading…
Reference in New Issue