restore test
switch provisioner validation to cast to []interface{} first
This commit is contained in:
parent
732211617e
commit
d1448fc319
|
@ -293,7 +293,8 @@ func validateFn(c *terraform.ResourceConfig) (ws []string, es []error) {
|
|||
// Validate service level configs
|
||||
services, ok := c.Get("service")
|
||||
if ok {
|
||||
for _, service := range services.([]map[string]interface{}) {
|
||||
for _, svc := range services.([]interface{}) {
|
||||
service := svc.(map[string]interface{})
|
||||
strategy, ok := service["strategy"].(string)
|
||||
if ok && !updateStrategies[strategy] {
|
||||
es = append(es, errors.New(strategy+" is not a valid update strategy."))
|
||||
|
|
|
@ -47,7 +47,6 @@ func TestResourceProvisioner_Validate_bad(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
/* FIXME panic: interface conversion: interface {} is []interface {}, not []map[string]interface {}
|
||||
func TestResourceProvisioner_Validate_bad_service_config(t *testing.T) {
|
||||
c := testConfig(t, map[string]interface{}{
|
||||
"service": []interface{}{
|
||||
|
@ -68,7 +67,6 @@ func TestResourceProvisioner_Validate_bad_service_config(t *testing.T) {
|
|||
t.Fatalf("Should have three errors")
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func testConfig(t *testing.T, c map[string]interface{}) *terraform.ResourceConfig {
|
||||
return terraform.NewResourceConfigRaw(c)
|
||||
|
|
Loading…
Reference in New Issue