Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix TestAccAppEngineApplication* tests #15344

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/8486.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
24 changes: 15 additions & 9 deletions google/resource_app_engine_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ func TestAccAppEngineApplication_basic(t *testing.T) {

org := envvar.GetTestOrgFromEnv(t)
pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t))
billingAccount := envvar.GetTestBillingAccountFromEnv(t)

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
{
Config: testAccAppEngineApplication_basic(pid, org),
Config: testAccAppEngineApplication_basic(pid, org, billingAccount),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("google_app_engine_application.acceptance", "url_dispatch_rule.#"),
resource.TestCheckResourceAttrSet("google_app_engine_application.acceptance", "name"),
Expand All @@ -36,7 +38,7 @@ func TestAccAppEngineApplication_basic(t *testing.T) {
ImportStateVerify: true,
},
{
Config: testAccAppEngineApplication_update(pid, org),
Config: testAccAppEngineApplication_update(pid, org, billingAccount),
},
{
ResourceName: "google_app_engine_application.acceptance",
Expand All @@ -52,13 +54,14 @@ func TestAccAppEngineApplication_withIAP(t *testing.T) {

org := envvar.GetTestOrgFromEnv(t)
pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t))
billingAccount := envvar.GetTestBillingAccountFromEnv(t)

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
{
Config: testAccAppEngineApplication_withIAP(pid, org),
Config: testAccAppEngineApplication_withIAP(pid, org, billingAccount),
},
{
ResourceName: "google_app_engine_application.acceptance",
Expand All @@ -70,12 +73,13 @@ func TestAccAppEngineApplication_withIAP(t *testing.T) {
})
}

func testAccAppEngineApplication_withIAP(pid, org string) string {
func testAccAppEngineApplication_withIAP(pid, org, billingAccount string) string {
return fmt.Sprintf(`
resource "google_project" "acceptance" {
project_id = "%s"
name = "%s"
org_id = "%s"
billing_account = "%s"
}

resource "google_app_engine_application" "acceptance" {
Expand All @@ -90,15 +94,16 @@ resource "google_app_engine_application" "acceptance" {
oauth2_client_secret = "test"
}
}
`, pid, pid, org)
`, pid, pid, org, billingAccount)
}

func testAccAppEngineApplication_basic(pid, org string) string {
func testAccAppEngineApplication_basic(pid, org, billingAccount string) string {
return fmt.Sprintf(`
resource "google_project" "acceptance" {
project_id = "%s"
name = "%s"
org_id = "%s"
billing_account = "%s"
}

resource "google_app_engine_application" "acceptance" {
Expand All @@ -108,15 +113,16 @@ resource "google_app_engine_application" "acceptance" {
database_type = "CLOUD_DATASTORE_COMPATIBILITY"
serving_status = "SERVING"
}
`, pid, pid, org)
`, pid, pid, org, billingAccount)
}

func testAccAppEngineApplication_update(pid, org string) string {
func testAccAppEngineApplication_update(pid, org, billingAccount string) string {
return fmt.Sprintf(`
resource "google_project" "acceptance" {
project_id = "%s"
name = "%s"
org_id = "%s"
billing_account = "%s"
}

resource "google_app_engine_application" "acceptance" {
Expand All @@ -126,5 +132,5 @@ resource "google_app_engine_application" "acceptance" {
database_type = "CLOUD_DATASTORE_COMPATIBILITY"
serving_status = "USER_DISABLED"
}
`, pid, pid, org)
`, pid, pid, org, billingAccount)
}
6 changes: 4 additions & 2 deletions google/resource_app_engine_firewall_rule_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ func TestAccAppEngineFirewallRule_appEngineFirewallRuleBasicExample(t *testing.T
t.Parallel()

context := map[string]interface{}{
"org_id": envvar.GetTestOrgFromEnv(t),
"random_suffix": acctest.RandString(t, 10),
"org_id": envvar.GetTestOrgFromEnv(t),
"billing_account": envvar.GetTestBillingAccountFromEnv(t),
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
Expand All @@ -62,6 +63,7 @@ resource "google_project" "my_project" {
name = "tf-test-project"
project_id = "tf-test-ae-project%{random_suffix}"
org_id = "%{org_id}"
billing_account = "%{billing_account}"
}

resource "google_app_engine_application" "app" {
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/app_engine_firewall_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ resource "google_project" "my_project" {
name = "tf-test-project"
project_id = "ae-project"
org_id = "123456789"
billing_account = "000000-0000000-0000000-000000"
}

resource "google_app_engine_application" "app" {
Expand Down