2013-05-22 19:46:23 -04:00
|
|
|
package packer
|
|
|
|
|
|
|
|
type TestBuilder struct {
|
|
|
|
prepareCalled bool
|
2013-06-14 15:27:50 -04:00
|
|
|
prepareConfig []interface{}
|
2013-05-22 19:46:23 -04:00
|
|
|
runCalled bool
|
2013-06-10 01:00:47 -04:00
|
|
|
runCache Cache
|
2013-05-22 19:46:23 -04:00
|
|
|
runHook Hook
|
|
|
|
runUi Ui
|
2013-06-03 17:44:34 -04:00
|
|
|
cancelCalled bool
|
2013-05-22 19:46:23 -04:00
|
|
|
}
|
|
|
|
|
2013-06-14 15:27:50 -04:00
|
|
|
func (tb *TestBuilder) Prepare(config ...interface{}) error {
|
2013-05-22 19:46:23 -04:00
|
|
|
tb.prepareCalled = true
|
|
|
|
tb.prepareConfig = config
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2013-06-12 18:58:02 -04:00
|
|
|
func (tb *TestBuilder) Run(ui Ui, h Hook, c Cache) (Artifact, error) {
|
2013-05-22 19:46:23 -04:00
|
|
|
tb.runCalled = true
|
|
|
|
tb.runHook = h
|
|
|
|
tb.runUi = ui
|
2013-06-10 01:00:47 -04:00
|
|
|
tb.runCache = c
|
2013-06-18 13:54:22 -04:00
|
|
|
return new(TestArtifact), nil
|
2013-05-22 19:46:23 -04:00
|
|
|
}
|
2013-06-03 17:44:34 -04:00
|
|
|
|
|
|
|
func (tb *TestBuilder) Cancel() {
|
|
|
|
tb.cancelCalled = true
|
|
|
|
}
|