Skip to content

Commit

Permalink
Removed cloud armor tests that modify the default test project (#11372)
Browse files Browse the repository at this point in the history
  • Loading branch information
melinath authored Aug 6, 2024
1 parent 8299248 commit 61e38a4
Showing 1 changed file with 12 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,20 @@ import (
)

func TestAccComputeProjectCloudArmorTier_basic(t *testing.T) {
acctest.SkipIfVcr(t)
t.Parallel()

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
{
Config: testAccComputeProject_cloudArmorTier_standard(),
},
{
ResourceName: "google_compute_project_cloud_armor_tier.cloud_armor_tier_config",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccComputeProjectCloudArmorTier_modify(t *testing.T) {
acctest.SkipIfVcr(t)
t.Parallel()
context := map[string]interface{}{
"org": envvar.GetTestOrgFromEnv(t),
"billingId": envvar.GetTestBillingAccountFromEnv(t),
"projectID": fmt.Sprintf("tf-test-%d", acctest.RandInt(t)),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
{
Config: testAccComputeProject_cloudArmorTier_standard(),
},
{
ResourceName: "google_compute_project_cloud_armor_tier.cloud_armor_tier_config",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccComputeProject_cloudArmorTier_enterprise_paygo(),
},
{
ResourceName: "google_compute_project_cloud_armor_tier.cloud_armor_tier_config",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccComputeProject_cloudArmorTier_standard(),
Config: testAccComputeProject_cloudArmorTier_standard(context),
},
{
ResourceName: "google_compute_project_cloud_armor_tier.cloud_armor_tier_config",
Expand All @@ -65,7 +34,7 @@ func TestAccComputeProjectCloudArmorTier_modify(t *testing.T) {
})
}

func TestAccComputeProjectCloudArmorTier_withProjectSet(t *testing.T) {
func TestAccComputeProjectCloudArmorTier_modify(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
Expand All @@ -79,23 +48,23 @@ func TestAccComputeProjectCloudArmorTier_withProjectSet(t *testing.T) {
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
{
Config: testAccComputeProject_cloudArmorTier_withProjectSet_standard(context),
Config: testAccComputeProject_cloudArmorTier_standard(context),
},
{
ResourceName: "google_compute_project_cloud_armor_tier.cloud_armor_tier_config",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccComputeProject_cloudArmorTier_withProjectSet_enterprise_paygo(context),
Config: testAccComputeProject_cloudArmorTier_enterprise_paygo(context),
},
{
ResourceName: "google_compute_project_cloud_armor_tier.cloud_armor_tier_config",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccComputeProject_cloudArmorTier_withProjectSet_standard(context),
Config: testAccComputeProject_cloudArmorTier_standard(context),
},
{
ResourceName: "google_compute_project_cloud_armor_tier.cloud_armor_tier_config",
Expand All @@ -106,21 +75,7 @@ func TestAccComputeProjectCloudArmorTier_withProjectSet(t *testing.T) {
})
}

func testAccComputeProject_cloudArmorTier_enterprise_paygo() string {
return fmt.Sprintln(`
resource "google_compute_project_cloud_armor_tier" "cloud_armor_tier_config" {
cloud_armor_tier = "CA_ENTERPRISE_PAYGO"
}`)
}

func testAccComputeProject_cloudArmorTier_standard() string {
return fmt.Sprintln(`
resource "google_compute_project_cloud_armor_tier" "cloud_armor_tier_config" {
cloud_armor_tier = "CA_STANDARD"
}`)
}

func testAccComputeProject_cloudArmorTier_withProjectSet_enterprise_paygo(context map[string]interface{}) string {
func testAccComputeProject_cloudArmorTier_enterprise_paygo(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_project" "project" {
project_id = "%{projectID}"
Expand All @@ -142,7 +97,7 @@ resource "google_compute_project_cloud_armor_tier" "cloud_armor_tier_config" {
`, context)
}

func testAccComputeProject_cloudArmorTier_withProjectSet_standard(context map[string]interface{}) string {
func testAccComputeProject_cloudArmorTier_standard(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_project" "project" {
project_id = "%{projectID}"
Expand Down

0 comments on commit 61e38a4

Please sign in to comment.