packer: coreBuild.Cancel calls the builder Cancel method
This commit is contained in:
parent
30a061a855
commit
94cfe39a76
|
@ -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) {
|
||||||
|
|
||||||
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")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue