packer-cn/builder/openstack/builder_test.go

31 lines
558 B
Go
Raw Normal View History

package openstack
import (
"testing"
2018-01-22 20:21:10 -05:00
2020-12-01 16:42:11 -05:00
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestBuilder_ImplementsBuilder(t *testing.T) {
var raw interface{}
raw = &Builder{}
2020-12-01 16:42:11 -05:00
if _, ok := raw.(packersdk.Builder); !ok {
t.Fatalf("Builder should be a builder")
}
}
func TestBuilder_Prepare_BadType(t *testing.T) {
b := &Builder{}
c := map[string]interface{}{
"password": []string{},
}
_, warns, err := b.Prepare(c)
2013-11-03 00:03:59 -04:00
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
if err == nil {
t.Fatalf("prepare should fail")
}
}