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

Removed TestAccComposer1Environment_withNodeConfig #12544

Merged
merged 1 commit into from
Dec 12, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -760,43 +760,6 @@ func TestAccComposerEnvironment_composerV2MasterAuthNetworksUpdate(t *testing.T)
})
}

func TestAccComposer1Environment_withNodeConfig(t *testing.T) {
t.Parallel()

envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t))
network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t))
subnetwork := network + "-1"
serviceAccount := fmt.Sprintf("tf-test-%d", acctest.RandInt(t))

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccComposerEnvironmentDestroyProducer(t),
ExternalProviders: map[string]resource.ExternalProvider{
"time": {},
},
Steps: []resource.TestStep{
{
Config: testAccComposer1Environment_nodeCfg(envName, network, subnetwork, serviceAccount),
},
{
ResourceName: "google_composer_environment.test",
ImportState: true,
ImportStateVerify: true,
},
// This is a terrible clean-up step in order to get destroy to succeed,
// due to dangling firewall rules left by the Composer Environment blocking network deletion.
// TODO: Remove this check if firewall rules bug gets fixed by Composer.
{
PlanOnly: true,
ExpectNonEmptyPlan: false,
Config: testAccComposer1Environment_nodeCfg(envName, network, subnetwork, serviceAccount),
Check: testAccCheckClearComposerEnvironmentFirewalls(t, network),
},
},
})
}

func TestAccComposer2Environment_withNodeConfig(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -2510,69 +2473,6 @@ resource "google_compute_subnetwork" "test" {
`, name, network, subnetwork)
}

func testAccComposer1Environment_nodeCfg(environment, network, subnetwork, serviceAccount string) string {
return fmt.Sprintf(`
data "google_project" "project" {}

resource "google_composer_environment" "test" {
name = "%s"
region = "us-central1"
config {
node_config {
network = google_compute_network.test.self_link
subnetwork = google_compute_subnetwork.test.self_link
zone = "us-central1-a"

service_account = google_service_account.test.name
{{- if ne $.TargetVersionName "ga" }}
max_pods_per_node = 33
{{- end }}
ip_allocation_policy {
use_ip_aliases = true
cluster_ipv4_cidr_block = "10.0.0.0/16"
}
tags = toset(["t1", "t2"])
machine_type = "n2-highcpu-2"
disk_size_gb = 20
oauth_scopes = toset(["https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/bigquery"])
}
software_config {
image_version = "composer-1-airflow-2"
}
}
depends_on = [time_sleep.wait_3_minutes]
}

resource "google_compute_network" "test" {
name = "%s"
auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "test" {
name = "%s"
ip_cidr_range = "10.2.0.0/16"
region = "us-central1"
network = google_compute_network.test.self_link
}

resource "time_sleep" "wait_3_minutes" {
depends_on = [google_project_iam_member.composer-worker]
create_duration = "3m"
}

resource "google_service_account" "test" {
account_id = "%s"
display_name = "Test Service Account for Composer Environment"
}

resource "google_project_iam_member" "composer-worker" {
project = data.google_project.project.project_id
role = "roles/composer.worker"
member = "serviceAccount:${google_service_account.test.email}"
}
`, environment, network, subnetwork, serviceAccount)
}

func testAccComposer2Environment_nodeCfg(environment, network, subnetwork, serviceAccount string) string {
return fmt.Sprintf(`
data "google_project" "project" {}
Expand Down
Loading