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

provider/google: remove conflicting names from acceptance tests #4516

Merged
merged 1 commit into from
Jan 5, 2016
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
7 changes: 4 additions & 3 deletions builtin/providers/google/resource_compute_address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"google.golang.org/api/compute/v1"
Expand Down Expand Up @@ -75,7 +76,7 @@ func testAccCheckComputeAddressExists(n string, addr *compute.Address) resource.
}
}

const testAccComputeAddress_basic = `
var testAccComputeAddress_basic = fmt.Sprintf(`
resource "google_compute_address" "foobar" {
name = "terraform-test"
}`
name = "address-test-%s"
}`, acctest.RandString(10))
25 changes: 13 additions & 12 deletions builtin/providers/google/resource_compute_autoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"google.golang.org/api/compute/v1"
Expand Down Expand Up @@ -130,9 +131,9 @@ func testAccCheckAutoscalerUpdated(n string, max int64) resource.TestCheckFunc {
}
}

const testAccAutoscaler_basic = `
var testAccAutoscaler_basic = fmt.Sprintf(`
resource "google_compute_instance_template" "foobar" {
name = "terraform-test-template-foobar"
name = "ascaler-test-%s"
machine_type = "n1-standard-1"
can_ip_forward = false
tags = ["foo", "bar"]
Expand All @@ -158,13 +159,13 @@ resource "google_compute_instance_template" "foobar" {

resource "google_compute_target_pool" "foobar" {
description = "Resource created for Terraform acceptance testing"
name = "terraform-test-tpool-foobar"
name = "ascaler-test-%s"
session_affinity = "CLIENT_IP_PROTO"
}

resource "google_compute_instance_group_manager" "foobar" {
description = "Terraform test instance group manager"
name = "terraform-test-groupmanager"
name = "ascaler-test-%s"
instance_template = "${google_compute_instance_template.foobar.self_link}"
target_pools = ["${google_compute_target_pool.foobar.self_link}"]
base_instance_name = "foobar"
Expand All @@ -173,7 +174,7 @@ resource "google_compute_instance_group_manager" "foobar" {

resource "google_compute_autoscaler" "foobar" {
description = "Resource created for Terraform acceptance testing"
name = "terraform-test-ascaler"
name = "ascaler-test-%s"
zone = "us-central1-a"
target = "${google_compute_instance_group_manager.foobar.self_link}"
autoscaling_policy = {
Expand All @@ -185,11 +186,11 @@ resource "google_compute_autoscaler" "foobar" {
}
}

}`
}`, acctest.RandString(10), acctest.RandString(10), acctest.RandString(10), acctest.RandString(10))

const testAccAutoscaler_update = `
var testAccAutoscaler_update = fmt.Sprintf(`
resource "google_compute_instance_template" "foobar" {
name = "terraform-test-template-foobar"
name = "ascaler-test-%s"
machine_type = "n1-standard-1"
can_ip_forward = false
tags = ["foo", "bar"]
Expand All @@ -215,13 +216,13 @@ resource "google_compute_instance_template" "foobar" {

resource "google_compute_target_pool" "foobar" {
description = "Resource created for Terraform acceptance testing"
name = "terraform-test-tpool-foobar"
name = "ascaler-test-%s"
session_affinity = "CLIENT_IP_PROTO"
}

resource "google_compute_instance_group_manager" "foobar" {
description = "Terraform test instance group manager"
name = "terraform-test-groupmanager"
name = "ascaler-test-%s"
instance_template = "${google_compute_instance_template.foobar.self_link}"
target_pools = ["${google_compute_target_pool.foobar.self_link}"]
base_instance_name = "foobar"
Expand All @@ -230,7 +231,7 @@ resource "google_compute_instance_group_manager" "foobar" {

resource "google_compute_autoscaler" "foobar" {
description = "Resource created for Terraform acceptance testing"
name = "terraform-test-ascaler"
name = "ascaler-test-%s"
zone = "us-central1-a"
target = "${google_compute_instance_group_manager.foobar.self_link}"
autoscaling_policy = {
Expand All @@ -242,4 +243,4 @@ resource "google_compute_autoscaler" "foobar" {
}
}

}`
}`, acctest.RandString(10), acctest.RandString(10), acctest.RandString(10), acctest.RandString(10))
17 changes: 9 additions & 8 deletions builtin/providers/google/resource_compute_firewall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"google.golang.org/api/compute/v1"
Expand Down Expand Up @@ -118,31 +119,31 @@ func testAccCheckComputeFirewallPorts(
}
}

const testAccComputeFirewall_basic = `
var testAccComputeFirewall_basic = fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "terraform-test"
name = "firewall-test-%s"
ipv4_range = "10.0.0.0/16"
}

resource "google_compute_firewall" "foobar" {
name = "terraform-test"
name = "firewall-test-%s"
description = "Resource created for Terraform acceptance testing"
network = "${google_compute_network.foobar.name}"
source_tags = ["foo"]

allow {
protocol = "icmp"
}
}`
}`, acctest.RandString(10), acctest.RandString(10))

const testAccComputeFirewall_update = `
var testAccComputeFirewall_update = fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "terraform-test"
name = "firewall-test-%s"
ipv4_range = "10.0.0.0/16"
}

resource "google_compute_firewall" "foobar" {
name = "terraform-test"
name = "firewall-test-%s"
description = "Resource created for Terraform acceptance testing"
network = "${google_compute_network.foobar.name}"
source_tags = ["foo"]
Expand All @@ -151,4 +152,4 @@ resource "google_compute_firewall" "foobar" {
protocol = "tcp"
ports = ["80-255"]
}
}`
}`, acctest.RandString(10), acctest.RandString(10))
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"google.golang.org/api/compute/v1"
Expand Down Expand Up @@ -75,7 +76,7 @@ func testAccCheckComputeGlobalAddressExists(n string, addr *compute.Address) res
}
}

const testAccComputeGlobalAddress_basic = `
var testAccComputeGlobalAddress_basic = fmt.Sprintf(`
resource "google_compute_global_address" "foobar" {
name = "terraform-test"
}`
name = "address-test-%s"
}`, acctest.RandString(10))
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
Expand Down Expand Up @@ -95,41 +96,41 @@ func testAccCheckComputeGlobalForwardingRuleExists(n string) resource.TestCheckF
}
}

const testAccComputeGlobalForwardingRule_basic1 = `
var testAccComputeGlobalForwardingRule_basic1 = fmt.Sprintf(`
resource "google_compute_global_forwarding_rule" "foobar" {
description = "Resource created for Terraform acceptance testing"
ip_protocol = "TCP"
name = "terraform-test"
name = "gforward-test-%s"
port_range = "80"
target = "${google_compute_target_http_proxy.foobar1.self_link}"
}

resource "google_compute_target_http_proxy" "foobar1" {
description = "Resource created for Terraform acceptance testing"
name = "terraform-test1"
name = "gforward-test-%s"
url_map = "${google_compute_url_map.foobar.self_link}"
}

resource "google_compute_target_http_proxy" "foobar2" {
description = "Resource created for Terraform acceptance testing"
name = "terraform-test2"
name = "gforward-test-%s"
url_map = "${google_compute_url_map.foobar.self_link}"
}

resource "google_compute_backend_service" "foobar" {
name = "service"
name = "gforward-test-%s"
health_checks = ["${google_compute_http_health_check.zero.self_link}"]
}

resource "google_compute_http_health_check" "zero" {
name = "tf-test-zero"
name = "gforward-test-%s"
request_path = "/"
check_interval_sec = 1
timeout_sec = 1
}

resource "google_compute_url_map" "foobar" {
name = "myurlmap"
name = "gforward-test-%s"
default_service = "${google_compute_backend_service.foobar.self_link}"
host_rule {
hosts = ["mysite.com", "myothersite.com"]
Expand All @@ -149,43 +150,44 @@ resource "google_compute_url_map" "foobar" {
service = "${google_compute_backend_service.foobar.self_link}"
}
}
`
`, acctest.RandString(10), acctest.RandString(10), acctest.RandString(10),
acctest.RandString(10), acctest.RandString(10), acctest.RandString(10))

const testAccComputeGlobalForwardingRule_basic2 = `
var testAccComputeGlobalForwardingRule_basic2 = fmt.Sprintf(`
resource "google_compute_global_forwarding_rule" "foobar" {
description = "Resource created for Terraform acceptance testing"
ip_protocol = "TCP"
name = "terraform-test"
name = "gforward-test-%s"
port_range = "80"
target = "${google_compute_target_http_proxy.foobar2.self_link}"
}

resource "google_compute_target_http_proxy" "foobar1" {
description = "Resource created for Terraform acceptance testing"
name = "terraform-test1"
name = "gforward-test-%s"
url_map = "${google_compute_url_map.foobar.self_link}"
}

resource "google_compute_target_http_proxy" "foobar2" {
description = "Resource created for Terraform acceptance testing"
name = "terraform-test2"
name = "gforward-test-%s"
url_map = "${google_compute_url_map.foobar.self_link}"
}

resource "google_compute_backend_service" "foobar" {
name = "service"
name = "gforward-test-%s"
health_checks = ["${google_compute_http_health_check.zero.self_link}"]
}

resource "google_compute_http_health_check" "zero" {
name = "tf-test-zero"
name = "gforward-test-%s"
request_path = "/"
check_interval_sec = 1
timeout_sec = 1
}

resource "google_compute_url_map" "foobar" {
name = "myurlmap"
name = "gforward-test-%s"
default_service = "${google_compute_backend_service.foobar.self_link}"
host_rule {
hosts = ["mysite.com", "myothersite.com"]
Expand All @@ -205,4 +207,5 @@ resource "google_compute_url_map" "foobar" {
service = "${google_compute_backend_service.foobar.self_link}"
}
}
`
`, acctest.RandString(10), acctest.RandString(10), acctest.RandString(10),
acctest.RandString(10), acctest.RandString(10), acctest.RandString(10))
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"google.golang.org/api/compute/v1"
Expand Down Expand Up @@ -137,35 +138,35 @@ func testAccCheckComputeHttpHealthCheckThresholds(healthy, unhealthy int64, heal
}
}

const testAccComputeHttpHealthCheck_basic = `
var testAccComputeHttpHealthCheck_basic = fmt.Sprintf(`
resource "google_compute_http_health_check" "foobar" {
check_interval_sec = 3
description = "Resource created for Terraform acceptance testing"
healthy_threshold = 3
host = "foobar"
name = "terraform-test"
name = "httphealth-test-%s"
port = "80"
request_path = "/health_check"
timeout_sec = 2
unhealthy_threshold = 3
}
`
`, acctest.RandString(10))

const testAccComputeHttpHealthCheck_update1 = `
var testAccComputeHttpHealthCheck_update1 = fmt.Sprintf(`
resource "google_compute_http_health_check" "foobar" {
name = "terraform-test"
name = "httphealth-test-%s"
description = "Resource created for Terraform acceptance testing"
request_path = "/not_default"
}
`
`, acctest.RandString(10))

/* Change description, restore request_path to default, and change
* thresholds from defaults */
const testAccComputeHttpHealthCheck_update2 = `
var testAccComputeHttpHealthCheck_update2 = fmt.Sprintf(`
resource "google_compute_http_health_check" "foobar" {
name = "terraform-test"
name = "httphealth-test-%s"
description = "Resource updated for Terraform acceptance testing"
healthy_threshold = 10
unhealthy_threshold = 10
}
`
`, acctest.RandString(10))
Loading