packer-cn/builder/virtualbox/common/export_config_test.go

37 lines
666 B
Go
Raw Normal View History

2013-12-22 13:40:39 -05:00
package common
import (
"testing"
"github.com/hashicorp/packer/template/interpolate"
2013-12-22 13:40:39 -05:00
)
func TestExportConfigPrepare_BootWait(t *testing.T) {
var c *ExportConfig
var errs []error
// Bad
c = new(ExportConfig)
2018-03-13 04:02:43 -04:00
c.Format = "illegal"
errs = c.Prepare(interpolate.NewContext())
2013-12-22 13:40:39 -05:00
if len(errs) == 0 {
t.Fatalf("bad: %#v", errs)
}
// Good
c = new(ExportConfig)
c.Format = "ova"
errs = c.Prepare(interpolate.NewContext())
2013-12-22 13:40:39 -05:00
if len(errs) > 0 {
t.Fatalf("should not have error: %s", errs)
}
// Good
c = new(ExportConfig)
c.Format = "ovf"
errs = c.Prepare(interpolate.NewContext())
2013-12-22 13:40:39 -05:00
if len(errs) > 0 {
t.Fatalf("should not have error: %s", errs)
}
}