Commit 94cfe39a authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer: coreBuild.Cancel calls the builder Cancel method

parent 30a061a8
...@@ -91,4 +91,5 @@ func (b *coreBuild) Run(ui Ui) Artifact { ...@@ -91,4 +91,5 @@ func (b *coreBuild) Run(ui Ui) Artifact {
// Cancels the build if it is running. // Cancels the build if it is running.
func (b *coreBuild) Cancel() { func (b *coreBuild) Cancel() {
b.builder.Cancel()
} }
...@@ -92,3 +92,15 @@ func TestBuild_RunBeforePrepare(t *testing.T) { ...@@ -92,3 +92,15 @@ func TestBuild_RunBeforePrepare(t *testing.T) {
testBuild().Run(testUi()) 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")
}
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