cleanup error handling and some for loops

This commit is contained in:
James Bardin 2020-12-01 09:15:36 -05:00
parent 96436f526a
commit f521fcca97
4 changed files with 8 additions and 5 deletions

View File

@ -108,7 +108,7 @@ func TestPlanApplyInAutomation(t *testing.T) {
stateResources := state.RootModule().Resources
var gotResources []string
for n, _ := range stateResources {
for n := range stateResources {
gotResources = append(gotResources, n)
}
sort.Strings(gotResources)

View File

@ -107,7 +107,7 @@ func TestPrimarySeparatePlan(t *testing.T) {
stateResources := state.RootModule().Resources
var gotResources []string
for n, _ := range stateResources {
for n := range stateResources {
gotResources = append(gotResources, n)
}
sort.Strings(gotResources)

View File

@ -54,7 +54,7 @@ func TestTerraformProvidersMirror(t *testing.T) {
"registry.terraform.io/hashicorp/template/terraform-provider-template_2.1.1_windows_386.zip",
}
var got []string
err = filepath.Walk(outputDir, func(path string, info os.FileInfo, err error) error {
walkErr := filepath.Walk(outputDir, func(path string, info os.FileInfo, err error) error {
if info.IsDir() {
return nil // we only care about leaf files for this test
}
@ -65,8 +65,8 @@ func TestTerraformProvidersMirror(t *testing.T) {
got = append(got, filepath.ToSlash(relPath))
return nil
})
if err != nil {
t.Fatal(err)
if walkErr != nil {
t.Fatal(walkErr)
}
sort.Strings(got)

View File

@ -140,6 +140,9 @@ func TestUnmanagedSeparatePlan(t *testing.T) {
},
},
})
if err != nil {
t.Fatal(err)
}
tf.AddEnv("TF_REATTACH_PROVIDERS=" + string(reattachStr))
tf.AddEnv("PLUGIN_PROTOCOL_VERSION=5")