Skip to content

Commit

Permalink
Test updates to not depend on id format. Also test fixes (#2609)
Browse files Browse the repository at this point in the history
* Test updates to not depend on id format. Also test fixes

* Typo

* location -> region in node pool test
  • Loading branch information
slevenick authored Nov 7, 2019
1 parent 8540fe2 commit 566f50b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ func testAccCheckComputeSslCertificateExists(n string) resource.TestCheckFunc {
}

config := testAccProvider.Meta().(*Config)
// We don't specify a name, but it is saved during create
name := rs.Primary.Attributes["name"]

found, err := config.clientCompute.SslCertificates.Get(
config.Project, rs.Primary.ID).Do()
config.Project, name).Do()
if err != nil {
return err
}

if found.Name != rs.Primary.ID {
if found.Name != name {
return fmt.Errorf("Certificate not found")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func testAccCheckComputeSslPolicyExists(n string, sslPolicy *compute.SslPolicy)
return fmt.Errorf("Error Reading SSL Policy %s: %s", name, err)
}

if found.Name != rs.Primary.ID {
if found.Name != name {
return fmt.Errorf("SSL Policy not found")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ func testAccCheckComputeTargetHttpProxyExists(n string) resource.TestCheckFunc {
}

config := testAccProvider.Meta().(*Config)
name := rs.Attributes["name"]

found, err := config.clientCompute.TargetHttpProxies.Get(
config.Project, rs.Primary.ID).Do()
config.Project, name).Do()
if err != nil {
return err
}

if found.Name != rs.Primary.ID {
if found.Name != name {
return fmt.Errorf("TargetHttpProxy not found")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ func testAccCheckComputeTargetHttpsProxyExists(n string, proxy *compute.TargetHt
}

config := testAccProvider.Meta().(*Config)
name := rs.Primary.Attributes["name"]

found, err := config.clientCompute.TargetHttpsProxies.Get(
config.Project, rs.Primary.ID).Do()
config.Project, name).Do()
if err != nil {
return err
}

if found.Name != rs.Primary.ID {
if found.Name != name {
return fmt.Errorf("TargetHttpsProxy not found")
}

Expand Down
5 changes: 3 additions & 2 deletions third_party/terraform/tests/resource_compute_url_map_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,15 @@ func testAccCheckComputeUrlMapExists(n string) resource.TestCheckFunc {
}

config := testAccProvider.Meta().(*Config)
name := rs.Primary.Attributes["name"]

found, err := config.clientCompute.UrlMaps.Get(
config.Project, rs.Primary.ID).Do()
config.Project, name).Do()
if err != nil {
return err
}

if found.Name != rs.Primary.ID {
if found.Name != name {
return fmt.Errorf("Url map not found")
}
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ resource "google_compute_subnetwork" "container_subnetwork" {
name = "${google_compute_network.container_network.name}"
network = "${google_compute_network.container_network.name}"
ip_cidr_range = "10.0.36.0/24"
location = "us-central1"
region = "us-central1"
private_ip_google_access = true

secondary_ip_range {
Expand Down

0 comments on commit 566f50b

Please sign in to comment.