builder/amazonebs: Artifact ID works
This commit is contained in:
parent
0f0041725e
commit
227ab55617
|
@ -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) {
|
||||||
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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue