Merge pull request #4994 from hashicorp/phinze/fix-heroku-cert-test

provider/heroku: address cert test failure
This commit is contained in:
Paul Hinze 2016-02-04 10:25:58 -06:00
commit 9ba761cbae
2 changed files with 6 additions and 3 deletions

View File

@ -58,7 +58,7 @@ func resourceHerokuCertCreate(d *schema.ResourceData, meta interface{}) error {
log.Printf("[DEBUG] SSL Certificate create configuration: %#v, %#v", app, opts)
a, err := client.SSLEndpointCreate(app, opts)
if err != nil {
panic(err)
return fmt.Errorf("Error creating SSL endpoint: %s", err)
}
d.SetId(a.ID)

View File

@ -7,6 +7,7 @@ import (
"testing"
"github.com/cyberdelia/heroku-go/v3"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
@ -17,9 +18,10 @@ func TestAccHerokuCert_Basic(t *testing.T) {
certificateChainFile := wd + "/test-fixtures/terraform.cert"
certificateChainBytes, _ := ioutil.ReadFile(certificateChainFile)
certificateChain := string(certificateChainBytes)
appName := fmt.Sprintf("tftest-%s", acctest.RandString(10))
testAccCheckHerokuCertConfig_basic := `
resource "heroku_app" "foobar" {
name = "terraform-test-cert-app"
name = "` + appName + `"
region = "eu"
}
@ -47,7 +49,8 @@ func TestAccHerokuCert_Basic(t *testing.T) {
testAccCheckHerokuCertExists("heroku_cert.ssl_certificate", &endpoint),
testAccCheckHerokuCertificateChain(&endpoint, certificateChain),
resource.TestCheckResourceAttr(
"heroku_cert.ssl_certificate", "cname", "terraform-test-cert-app.herokuapp.com"),
"heroku_cert.ssl_certificate",
"cname", fmt.Sprintf("%s.herokuapp.com", appName)),
),
},
},