packer: coreBuild.Cancel calls the builder Cancel method

This commit is contained in:
Mitchell Hashimoto 2013-06-03 16:06:04 -07:00
parent 30a061a855
commit 94cfe39a76
2 changed files with 13 additions and 0 deletions

View File

@ -91,4 +91,5 @@ func (b *coreBuild) Run(ui Ui) Artifact {
// Cancels the build if it is running.
func (b *coreBuild) Cancel() {
b.builder.Cancel()
}

View File

@ -92,3 +92,15 @@ func TestBuild_RunBeforePrepare(t *testing.T) {
testBuild().Run(testUi())
}
func TestBuild_Cancel(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
build := testBuild()
build.Cancel()
coreB := build.(*coreBuild)
builder := coreB.builder.(*TestBuilder)
assert.True(builder.cancelCalled, "cancel should be called")
}