Skip to content

Commit

Permalink
Fix multiple VCR tests (#6500)
Browse files Browse the repository at this point in the history
* fixed multiple currently failed VCR tests
  • Loading branch information
shuyama1 authored Sep 6, 2022
1 parent 0176a6d commit cae4012
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions mmv1/products/cgc/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
primary_resource_id: "trigger_pubsub_tf"
vars:
pubsub_workflow_tf: "pubsub-workflow-tf"
service_account: "eventarc-sa"
trigger_pubsub_workflow_tf: "trigger-pubsub-workflow-tf"
min_version: beta

Expand Down
5 changes: 5 additions & 0 deletions mmv1/templates/terraform/constants/cloud_run_service.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func cloudrunAnnotationDiffSuppress(k, old, new string, d *schema.ResourceData)
}

var cloudRunGoogleProvidedTemplateAnnotations = regexp.MustCompile(`template\.0\.metadata\.0\.annotations\.run\.googleapis\.com/sandbox`)
var cloudRunGoogleProvidedTemplateAnnotations_autoscaling_maxscale = regexp.MustCompile(`template\.0\.metadata\.0\.annotations\.autoscaling\.knative\.dev/maxScale`)

func cloudrunTemplateAnnotationDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
// Suppress diffs for the annotations provided by API
Expand All @@ -33,6 +34,10 @@ func cloudrunTemplateAnnotationDiffSuppress(k, old, new string, d *schema.Resour
return true
}

if cloudRunGoogleProvidedTemplateAnnotations_autoscaling_maxscale.MatchString(k) && new == "" {
return true
}

// For other keys, don't suppress diff.
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,16 @@ resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" {
image = "us-docker.pkg.dev/cloudrun/container/hello"
}
}
metadata {
annotations = {
"run.googleapis.com/vpc-access-connector" = google_vpc_access_connector.default.name
"run.googleapis.com/vpc-access-egress" = "all-traffic"
}
}
}

metadata {
annotations = {
"run.googleapis.com/vpc-access-connector" = google_vpc_access_connector.default.name
"run.googleapis.com/vpc-access-egress" = "all-traffic"
"run.googleapis.com/ingress" = "all"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ resource "google_project_service" "workflows" {
# Create a service account for Eventarc trigger and Workflows
resource "google_service_account" "eventarc_workflows_service_account" {
provider = google-beta
account_id = "eventarc-workflows-sa"
account_id = "<%= ctx[:vars]['service_account'] %>"
display_name = "Eventarc Workflows Service Account"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ func TestAccSqlDatabaseInstance_SqlServerAuditConfig(t *testing.T) {
databaseName := "tf-test-" + randString(t, 10)
rootPassword := randString(t, 15)
addressName := "tf-test-" + randString(t, 10)
networkName := BootstrapSharedTestNetwork(t, "sql-instance-private-allocated-ip-range")
networkName := BootstrapSharedTestNetwork(t, "sql-instance-sqlserver-audit")
bucketName := fmt.Sprintf("%s-%d", "tf-test-bucket", randInt(t))
uploadInterval := "900s"
retentionInterval := "86400s"
Expand Down

0 comments on commit cae4012

Please sign in to comment.