2013-07-15 02:56:28 -04:00
|
|
|
package instance
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/mitchellh/packer/packer"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2013-07-20 22:40:45 -04:00
|
|
|
func testConfig() map[string]interface{} {
|
|
|
|
return map[string]interface{}{}
|
|
|
|
}
|
|
|
|
|
2013-07-15 02:56:28 -04:00
|
|
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
|
|
|
var raw interface{}
|
|
|
|
raw = &Builder{}
|
|
|
|
if _, ok := raw.(packer.Builder); !ok {
|
|
|
|
t.Fatalf("Builder should be a builder")
|
|
|
|
}
|
|
|
|
}
|
2013-07-20 22:40:45 -04:00
|
|
|
|
|
|
|
func TestBuilderPrepare_InvalidKey(t *testing.T) {
|
|
|
|
var b Builder
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
// Add a random key
|
|
|
|
config["i_should_not_be_valid"] = true
|
|
|
|
err := b.Prepare(config)
|
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should have error")
|
|
|
|
}
|
|
|
|
}
|