From db87c12872e4c0cca768c0e4c0931b6142ea98ba Mon Sep 17 00:00:00 2001 From: Shuya Ma <87669292+shuyama1@users.noreply.github.com> Date: Thu, 26 Oct 2023 09:24:01 -0700 Subject: [PATCH] fix TestAccDataprocVirtualCluster_basic (#9362) --- .../resource_dataproc_cluster_test.go.erb | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.erb b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.erb index a747f05ca68b..87b86667e9fc 100644 --- a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.erb @@ -105,7 +105,6 @@ func TestAccDataprocCluster_basic(t *testing.T) { }) } -<% if version == "ga" -%> func TestAccDataprocVirtualCluster_basic(t *testing.T) { t.Parallel() @@ -113,9 +112,8 @@ func TestAccDataprocVirtualCluster_basic(t *testing.T) { rnd := acctest.RandString(t, 10) pid := envvar.GetTestProjectFromEnv() version := "3.1-dataproc-7" - networkName := acctest.BootstrapSharedTestNetwork(t, "dataproc-cluster") - subnetworkName := acctest.BootstrapSubnet(t, "dataproc-cluster", networkName) - acctest.BootstrapFirewallForDataprocSharedNetwork(t, "dataproc-cluster", networkName) + networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") + subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -123,7 +121,7 @@ func TestAccDataprocVirtualCluster_basic(t *testing.T) { CheckDestroy: testAccCheckDataprocClusterDestroy(t), Steps: []resource.TestStep{ { - Config: testAccDataprocVirtualCluster_basic(pid, rnd, subnetworkName), + Config: testAccDataprocVirtualCluster_basic(pid, rnd, networkName, subnetworkName), Check: resource.ComposeTestCheckFunc( testAccCheckDataprocClusterExists(t, "google_dataproc_cluster.virtual_cluster", &cluster), @@ -145,7 +143,6 @@ func TestAccDataprocVirtualCluster_basic(t *testing.T) { }, }) } -<% end -%> func TestAccDataprocCluster_withAccelerators(t *testing.T) { t.Parallel() @@ -1257,8 +1254,7 @@ resource "google_dataproc_cluster" "basic" { `, rnd) } -<% if version == "ga" -%> -func testAccDataprocVirtualCluster_basic(projectID, rnd, subnetworkName string) string { +func testAccDataprocVirtualCluster_basic(projectID, rnd, networkName, subnetworkName string) string { return fmt.Sprintf(` data "google_project" "project" { project_id = "%s" @@ -1267,11 +1263,8 @@ data "google_project" "project" { resource "google_container_cluster" "primary" { name = "tf-test-gke-%s" location = "us-central1-a" - cluster_config { - gce_cluster_config { - subnetwork = "%s" - } - } + network = "%s" + subnetwork = "%s" initial_node_count = 1 @@ -1320,9 +1313,8 @@ resource "google_dataproc_cluster" "virtual_cluster" { } } } -`, projectID, rnd, subnetworkName, projectID, rnd, rnd, rnd, rnd, rnd, rnd) +`, projectID, rnd, networkName, subnetworkName, projectID, rnd, rnd, rnd, rnd, rnd, rnd) } -<% end -%> func testAccCheckDataprocGkeClusterNodePoolsHaveRoles(cluster *dataproc.Cluster, roles ...string) func(s *terraform.State) error { return func(s *terraform.State) error {