add case to decoder to assert to slice, then each item to a map
This commit is contained in:
parent
d1448fc319
commit
ec0402a238
|
@ -269,7 +269,6 @@ func TestProviderValidate(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
/* FIXME Invalid timeout structure: []interface {}{map[string]interface {}{"create":"40m"}}
|
||||
func TestProviderDiff_legacyTimeoutType(t *testing.T) {
|
||||
p := &Provider{
|
||||
ResourcesMap: map[string]*Resource{
|
||||
|
@ -307,7 +306,6 @@ func TestProviderDiff_legacyTimeoutType(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func TestProviderDiff_timeoutInvalidValue(t *testing.T) {
|
||||
p := &Provider{
|
||||
|
|
|
@ -78,6 +78,16 @@ func (t *ResourceTimeout) ConfigDecode(s *Resource, c *terraform.ResourceConfig)
|
|||
log.Printf("[ERROR] Invalid timeout value: %q", raw)
|
||||
return fmt.Errorf("Invalid Timeout value found")
|
||||
}
|
||||
case []interface{}:
|
||||
for _, r := range raw {
|
||||
if rMap, ok := r.(map[string]interface{}); ok {
|
||||
rawTimeouts = append(rawTimeouts, rMap)
|
||||
} else {
|
||||
// Go will not allow a fallthrough
|
||||
log.Printf("[ERROR] Invalid timeout structure: %#v", raw)
|
||||
return fmt.Errorf("Invalid Timeout structure found")
|
||||
}
|
||||
}
|
||||
default:
|
||||
log.Printf("[ERROR] Invalid timeout structure: %#v", raw)
|
||||
return fmt.Errorf("Invalid Timeout structure found")
|
||||
|
|
|
@ -122,7 +122,6 @@ func TestResourceTimeout_ConfigDecode(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
/* FIXME Expected good timeout returned:, Invalid Timeout structure found
|
||||
func TestResourceTimeout_legacyConfigDecode(t *testing.T) {
|
||||
r := &Resource{
|
||||
Timeouts: &ResourceTimeout{
|
||||
|
@ -158,7 +157,6 @@ func TestResourceTimeout_legacyConfigDecode(t *testing.T) {
|
|||
t.Fatalf("bad timeout decode.\nExpected:\n%#v\nGot:\n%#v\n", expected, timeout)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func TestResourceTimeout_DiffEncode_basic(t *testing.T) {
|
||||
cases := []struct {
|
||||
|
|
Loading…
Reference in New Issue