helper/resource: don't fail test on config warnings

AccTests like TestAccComputeInstance_basic_deprecated_network were
failing early on "invalid config" when we are explictly testing behavior
that we know generates warnings.
This commit is contained in:
Paul Hinze 2015-05-06 13:16:48 -05:00
parent 5d12c79d90
commit fbce3a3caa
1 changed files with 9 additions and 6 deletions

View File

@ -209,13 +209,16 @@ func testStep(
opts.Destroy = step.Destroy
ctx := terraform.NewContext(&opts)
if ws, es := ctx.Validate(); len(ws) > 0 || len(es) > 0 {
estrs := make([]string, len(es))
for i, e := range es {
estrs[i] = e.Error()
if len(es) > 0 {
estrs := make([]string, len(es))
for i, e := range es {
estrs[i] = e.Error()
}
return state, fmt.Errorf(
"Configuration is invalid.\n\nWarnings: %#v\n\nErrors: %#v",
ws, estrs)
}
return state, fmt.Errorf(
"Configuration is invalid.\n\nWarnings: %#v\n\nErrors: %#v",
ws, estrs)
log.Printf("[WARN] Config warnings: %#v", ws)
}
// Refresh!