2017-01-03 12:29:14 +01:00
|
|
|
package ignition
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
|
|
"github.com/hashicorp/terraform/terraform"
|
|
|
|
)
|
|
|
|
|
|
|
|
var testProviders = map[string]terraform.ResourceProvider{
|
|
|
|
"ignition": Provider(),
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestProvider(t *testing.T) {
|
|
|
|
if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestValidateUnit(t *testing.T) {
|
2017-01-17 12:49:45 +01:00
|
|
|
if err := validateUnitContent(""); err == nil {
|
2017-01-03 12:29:14 +01:00
|
|
|
t.Fatalf("error not found, expected error")
|
|
|
|
}
|
|
|
|
|
2017-01-17 12:49:45 +01:00
|
|
|
if err := validateUnitContent("[foo]qux"); err == nil {
|
2017-01-03 12:29:14 +01:00
|
|
|
t.Fatalf("error not found, expected error")
|
|
|
|
}
|
|
|
|
|
2017-01-17 12:49:45 +01:00
|
|
|
if err := validateUnitContent("[foo]\nqux=foo\nfoo"); err == nil {
|
2017-01-03 12:29:14 +01:00
|
|
|
t.Fatalf("error not found, expected error")
|
|
|
|
}
|
|
|
|
}
|