Skip to content

Commit

Permalink
More integration test fixes (#2617)
Browse files Browse the repository at this point in the history
* Fix bigtable for real, scratch disk size, target pool checks

* Proxy test fixes

* CloudIOT registry set removed field to nil. Add specific id format for access context manager
  • Loading branch information
slevenick authored and rileykarson committed Nov 13, 2019
1 parent 6228d25 commit 4152e82
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions products/accesscontextmanager/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
update_minutes: 6
delete_minutes: 6
autogen_async: true
id_format: "{{name}}"
import_format: ["{{name}}"]
examples:
- !ruby/object:Provider::Terraform::Examples
Expand Down
4 changes: 2 additions & 2 deletions third_party/terraform/resources/resource_bigtable_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func resourceBigtableTableCreate(d *schema.ResourceData, meta interface{}) error
}
}

id, err := replaceVars(d, config, "projects/{{project}}/instances/{{instance_id}}/tables/{{name}}")
id, err := replaceVars(d, config, "projects/{{project}}/instances/{{instance_name}}/tables/{{name}}")
if err != nil {
return fmt.Errorf("Error constructing id: %s", err)
}
Expand All @@ -137,7 +137,7 @@ func resourceBigtableTableRead(d *schema.ResourceData, meta interface{}) error {

defer c.Close()

name := d.Id()
name := d.Get("name").(string)
table, err := c.TableInfo(ctx, name)
if err != nil {
log.Printf("[WARN] Removing %s because it's gone", name)
Expand Down
2 changes: 2 additions & 0 deletions third_party/terraform/resources/resource_cloudiot_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ func resourceCloudIoTRegistryRead(d *schema.ResourceData, meta interface{}) erro
}
d.Set("credentials", credentials)
d.Set("log_level", res.LogLevel)
// Removed Computed field must be set to nil to prevent spurious diffs
d.Set("event_notification_config", nil)

return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,7 @@ resource "google_compute_instance_template" "foobar" {
}
disk {
auto_delete = true
disk_size_gb = 375
type = "SCRATCH"
disk_type = "local-ssd"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func testAccCheckComputeTargetPoolHealthCheck(targetPool, healthCheck string) re

hcLink := healthCheckRes.Primary.Attributes["self_link"]
if targetPoolRes.Primary.Attributes["health_checks.0"] != hcLink {
return fmt.Errorf("Health check not set up. Expected %q", hcLink)
return fmt.Errorf("Health check not set up. Expected %q to equal %q", targetPoolRes.Primary.Attributes["health_checks.0"], hcLink)
}

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ func testAccCheckComputeTargetSslProxy(n, proxyHeader, sslCert string) resource.
}

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

found, err := config.clientCompute.TargetSslProxies.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("TargetSslProxy not found")
}

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

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

found, err := config.clientCompute.TargetTcpProxies.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("TargetTcpProxy not found")
}

Expand Down

0 comments on commit 4152e82

Please sign in to comment.