packer-cn/builder/azure/chroot/packerui_test.go

20 lines
445 B
Go
Raw Normal View History

2020-03-25 14:08:09 -04:00
package chroot
import (
"io/ioutil"
"strings"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
2020-03-25 14:08:09 -04:00
)
// testUI returns a test ui plus a function to retrieve the errors written to the ui
func testUI() (packersdk.Ui, func() string) {
2020-03-25 14:08:09 -04:00
errorBuffer := &strings.Builder{}
ui := &packersdk.BasicUi{
2020-03-25 14:08:09 -04:00
Reader: strings.NewReader(""),
Writer: ioutil.Discard,
ErrorWriter: errorBuffer,
}
return ui, errorBuffer.String
}