2013-12-25 18:01:57 -05:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2015-06-13 17:00:14 -04:00
|
|
|
|
2020-12-17 16:29:25 -05:00
|
|
|
"github.com/hashicorp/packer-plugin-sdk/common"
|
|
|
|
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
|
2013-12-25 18:01:57 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestOutputConfigPrepare(t *testing.T) {
|
|
|
|
c := new(OutputConfig)
|
|
|
|
if c.OutputDir != "" {
|
|
|
|
t.Fatalf("what: %s", c.OutputDir)
|
|
|
|
}
|
|
|
|
|
|
|
|
pc := &common.PackerConfig{PackerBuildName: "foo"}
|
2019-06-14 04:55:10 -04:00
|
|
|
errs := c.Prepare(interpolate.NewContext(), pc)
|
2013-12-25 18:01:57 -05:00
|
|
|
if len(errs) > 0 {
|
|
|
|
t.Fatalf("err: %#v", errs)
|
|
|
|
}
|
|
|
|
|
|
|
|
if c.OutputDir == "" {
|
|
|
|
t.Fatal("should have output dir")
|
|
|
|
}
|
|
|
|
}
|