helper/schema: test that validatefunc is not called with computed vals
This commit is contained in:
parent
8daa459e57
commit
4e7fcd4f42
|
@ -3469,6 +3469,7 @@ func TestSchemaMap_Validate(t *testing.T) {
|
||||||
},
|
},
|
||||||
Err: true,
|
Err: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"ValidateFunc gets decoded type": {
|
"ValidateFunc gets decoded type": {
|
||||||
Schema: map[string]*Schema{
|
Schema: map[string]*Schema{
|
||||||
"maybe": &Schema{
|
"maybe": &Schema{
|
||||||
|
@ -3486,6 +3487,27 @@ func TestSchemaMap_Validate(t *testing.T) {
|
||||||
"maybe": "true",
|
"maybe": "true",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"ValidateFunc is not called with a computed value": {
|
||||||
|
Schema: map[string]*Schema{
|
||||||
|
"validate_me": &Schema{
|
||||||
|
Type: TypeString,
|
||||||
|
Required: true,
|
||||||
|
ValidateFunc: func(v interface{}) (ws []string, es []error) {
|
||||||
|
es = append(es, fmt.Errorf("something is not right here"))
|
||||||
|
return
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Config: map[string]interface{}{
|
||||||
|
"validate_me": "${var.foo}",
|
||||||
|
},
|
||||||
|
Vars: map[string]string{
|
||||||
|
"var.foo": config.UnknownVariableValue,
|
||||||
|
},
|
||||||
|
|
||||||
|
Err: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for tn, tc := range cases {
|
for tn, tc := range cases {
|
||||||
|
|
Loading…
Reference in New Issue