packer-cn/packer/artifact_test.go
Julian Phillips 90a57c411f Expand Artifact API to expose build state
In order that something consuming an artifact can have access to extra
builder specific data add the State method which allows the caller to
ask for arbitary values by name.
2014-09-22 11:15:47 +01:00

39 lines
587 B
Go

package packer
type TestArtifact struct {
id string
state map[string]interface{}
destroyCalled bool
}
func (*TestArtifact) BuilderId() string {
return "bid"
}
func (*TestArtifact) Files() []string {
return []string{"a", "b"}
}
func (a *TestArtifact) Id() string {
id := a.id
if id == "" {
id = "id"
}
return id
}
func (*TestArtifact) String() string {
return "string"
}
func (a *TestArtifact) State(name string) interface{} {
value, _ := a.state[name]
return value
}
func (a *TestArtifact) Destroy() error {
a.destroyCalled = true
return nil
}