Skip to content

Commit

Permalink
fix buildpack test check [#249]
Browse files Browse the repository at this point in the history
  • Loading branch information
davidji99 committed Apr 10, 2020
1 parent 4f72eb3 commit 81a010b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions heroku/resource_heroku_app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package heroku
import (
"context"
"fmt"
"log"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
Expand Down Expand Up @@ -521,22 +522,26 @@ func testAccCheckHerokuAppBuildpacks(appName string, multi bool) resource.TestCh
return err
}

buildpacks := []string{}
log.Printf("[DEBUG] List of the app's buildpack installations: %v", results)

buildpacks := make([]string, 0)
for _, installation := range results {
buildpacks = append(buildpacks, installation.Buildpack.Name)
}

log.Printf("[DEBUG] List of the buildpacks: %v", buildpacks)

if multi {
herokuMulti := "https://github.com/heroku/heroku-buildpack-multi-procfile"
if len(buildpacks) != 2 || buildpacks[0] != herokuMulti || buildpacks[1] != "heroku/go" {
return fmt.Errorf("Bad buildpacks: %v", buildpacks)
return fmt.Errorf("bad buildpacks: %v", buildpacks)
}

return nil
}

if len(buildpacks) != 1 || buildpacks[0] != "heroku/go" {
return fmt.Errorf("Bad buildpacks: %v", buildpacks)
return fmt.Errorf("bad buildpacks: %v", buildpacks)
}

return nil
Expand All @@ -552,13 +557,13 @@ func testAccCheckHerokuAppNoBuildpacks(appName string) resource.TestCheckFunc {
return err
}

buildpacks := []string{}
buildpacks := make([]string, 0)
for _, installation := range results {
buildpacks = append(buildpacks, installation.Buildpack.Name)
}

if len(buildpacks) != 0 {
return fmt.Errorf("Bad buildpacks: %v", buildpacks)
return fmt.Errorf("bad buildpacks: %v", buildpacks)
}

return nil
Expand Down Expand Up @@ -760,6 +765,8 @@ resource "heroku_app" "foobar" {
name = "%s"
region = "us"
buildpacks = []
config_vars = {}
}`, appName)
}
Expand Down

0 comments on commit 81a010b

Please sign in to comment.