mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-08 23:23:59 -06:00
heroku: randomize the remaining appnames in tests
Should take care of the remaining flapping acceptance test failures like this: https://travis-ci.org/hashicorp/terraform/builds/104012729
This commit is contained in:
parent
b269b80803
commit
19d90ae00f
@ -5,12 +5,14 @@ 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"
|
||||
)
|
||||
|
||||
func TestAccHerokuDomain_Basic(t *testing.T) {
|
||||
var domain heroku.Domain
|
||||
appName := fmt.Sprintf("tftest-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
@ -18,16 +20,17 @@ func TestAccHerokuDomain_Basic(t *testing.T) {
|
||||
CheckDestroy: testAccCheckHerokuDomainDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccCheckHerokuDomainConfig_basic,
|
||||
Config: testAccCheckHerokuDomainConfig_basic(appName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckHerokuDomainExists("heroku_domain.foobar", &domain),
|
||||
testAccCheckHerokuDomainAttributes(&domain),
|
||||
resource.TestCheckResourceAttr(
|
||||
"heroku_domain.foobar", "hostname", "terraform.example.com"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"heroku_domain.foobar", "app", "terraform-test-app"),
|
||||
"heroku_domain.foobar", "app", appName),
|
||||
resource.TestCheckResourceAttr(
|
||||
"heroku_domain.foobar", "cname", "terraform-test-app.herokuapp.com"),
|
||||
"heroku_domain.foobar", "cname",
|
||||
fmt.Sprintf("%s.herokuapp.com", appName)),
|
||||
),
|
||||
},
|
||||
},
|
||||
@ -93,13 +96,14 @@ func testAccCheckHerokuDomainExists(n string, Domain *heroku.Domain) resource.Te
|
||||
}
|
||||
}
|
||||
|
||||
const testAccCheckHerokuDomainConfig_basic = `
|
||||
resource "heroku_app" "foobar" {
|
||||
name = "terraform-test-app"
|
||||
func testAccCheckHerokuDomainConfig_basic(appName string) string {
|
||||
return fmt.Sprintf(`resource "heroku_app" "foobar" {
|
||||
name = "%s"
|
||||
region = "us"
|
||||
}
|
||||
|
||||
resource "heroku_domain" "foobar" {
|
||||
app = "${heroku_app.foobar.name}"
|
||||
hostname = "terraform.example.com"
|
||||
}`
|
||||
}`, appName)
|
||||
}
|
||||
|
@ -5,12 +5,14 @@ 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"
|
||||
)
|
||||
|
||||
func TestAccHerokuDrain_Basic(t *testing.T) {
|
||||
var drain heroku.LogDrain
|
||||
appName := fmt.Sprintf("tftest-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
@ -18,14 +20,14 @@ func TestAccHerokuDrain_Basic(t *testing.T) {
|
||||
CheckDestroy: testAccCheckHerokuDrainDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccCheckHerokuDrainConfig_basic,
|
||||
Config: testAccCheckHerokuDrainConfig_basic(appName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckHerokuDrainExists("heroku_drain.foobar", &drain),
|
||||
testAccCheckHerokuDrainAttributes(&drain),
|
||||
resource.TestCheckResourceAttr(
|
||||
"heroku_drain.foobar", "url", "syslog://terraform.example.com:1234"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"heroku_drain.foobar", "app", "terraform-test-app"),
|
||||
"heroku_drain.foobar", "app", appName),
|
||||
),
|
||||
},
|
||||
},
|
||||
@ -95,13 +97,15 @@ func testAccCheckHerokuDrainExists(n string, Drain *heroku.LogDrain) resource.Te
|
||||
}
|
||||
}
|
||||
|
||||
const testAccCheckHerokuDrainConfig_basic = `
|
||||
func testAccCheckHerokuDrainConfig_basic(appName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "heroku_app" "foobar" {
|
||||
name = "terraform-test-app"
|
||||
name = "%s"
|
||||
region = "us"
|
||||
}
|
||||
|
||||
resource "heroku_drain" "foobar" {
|
||||
app = "${heroku_app.foobar.name}"
|
||||
url = "syslog://terraform.example.com:1234"
|
||||
}`
|
||||
}`, appName)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user