2013-06-26 22:09:24 -04:00
|
|
|
package vagrant
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/mitchellh/packer/packer"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func testConfig() map[string]interface{} {
|
|
|
|
return map[string]interface{}{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
|
|
|
var raw interface{}
|
|
|
|
raw = &PostProcessor{}
|
|
|
|
if _, ok := raw.(packer.PostProcessor); !ok {
|
|
|
|
t.Fatalf("AWS PostProcessor should be a PostProcessor")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBuilderPrepare_OutputPath(t *testing.T) {
|
|
|
|
var p PostProcessor
|
|
|
|
|
2013-06-27 13:53:43 -04:00
|
|
|
// Default
|
2013-06-26 22:09:24 -04:00
|
|
|
c := testConfig()
|
|
|
|
delete(c, "output")
|
|
|
|
err := p.Configure(c)
|
2013-06-27 13:53:43 -04:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bad template
|
|
|
|
c["output"] = "bad {{{{.Template}}}}"
|
|
|
|
err = p.Configure(c)
|
2013-06-26 22:09:24 -04:00
|
|
|
if err == nil {
|
2013-06-27 13:53:43 -04:00
|
|
|
t.Fatal("should have error")
|
2013-06-26 22:09:24 -04:00
|
|
|
}
|
|
|
|
}
|
2013-06-28 10:16:38 -04:00
|
|
|
|
|
|
|
func TestBuilderPrepare_PPConfig(t *testing.T) {
|
|
|
|
var p PostProcessor
|
|
|
|
|
|
|
|
// Default
|
|
|
|
c := testConfig()
|
|
|
|
c["aws"] = map[string]interface{}{}
|
|
|
|
err := p.Configure(c)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
}
|