Commit 5a9a993c authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/amazonebs: Artifact ID works

parent 2df25986
...@@ -25,9 +25,13 @@ func (*artifact) Files() []string { ...@@ -25,9 +25,13 @@ func (*artifact) Files() []string {
return nil return nil
} }
func (*artifact) Id() string { func (a *artifact) Id() string {
// TODO(mitchellh): Id parts := make([]string, 0, len(a.amis))
return "TODO" for region, amiId := range a.amis {
parts = append(parts, fmt.Sprintf("%s:%s", region, amiId))
}
return strings.Join(parts, ",")
} }
func (a *artifact) String() string { func (a *artifact) String() string {
......
...@@ -13,6 +13,20 @@ func TestArtifact_Impl(t *testing.T) { ...@@ -13,6 +13,20 @@ func TestArtifact_Impl(t *testing.T) {
assert.Implementor(&artifact{}, &actual, "should be an Artifact") 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) { func TestArtifactString(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true) assert := asserts.NewTestingAsserts(t, true)
......
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