From 1dd06b4c5369f1c06e672f1550726e5d6357948a Mon Sep 17 00:00:00 2001 From: Chris Stephens Date: Fri, 24 May 2019 11:46:48 -0700 Subject: [PATCH] Adding Service udpate test --- .../tests/resource_cloudrun_service_test.go | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 third_party/terraform/tests/resource_cloudrun_service_test.go diff --git a/third_party/terraform/tests/resource_cloudrun_service_test.go b/third_party/terraform/tests/resource_cloudrun_service_test.go new file mode 100644 index 000000000000..7d19b1963fba --- /dev/null +++ b/third_party/terraform/tests/resource_cloudrun_service_test.go @@ -0,0 +1,78 @@ +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Magic Modules and manual +// changes will be clobbered when the file is regenerated. +// +// Please read more about how to change this file in +// .github/CONTRIBUTING.md. +// +// ---------------------------------------------------------------------------- + +package google + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccCloudrunService_cloudrunServiceUpdate(t *testing.T) { + t.Parallel() + + project := getTestProjectFromEnv() + name := "tftest-cloudrun-" + acctest.RandString(6) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCloudrunService_cloudrunServiceUpdate(name, project, "10"), + }, + { + ResourceName: "google_cloudrun_service.default", + ImportStateId: "us-central1/" + name, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"metadata.0.resource_version"}, + }, + { + Config: testAccCloudrunService_cloudrunServiceUpdate(name, project, "50"), + }, + { + ResourceName: "google_cloudrun_service.default", + ImportStateId: "us-central1/" + name, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"metadata.0.resource_version"}, + }, + }, + }) +} + +func testAccCloudrunService_cloudrunServiceUpdate(name, project, concurrency string) string { + return fmt.Sprintf(` +resource "google_cloudrun_service" "default" { + name = "%s" + location = "us-central1" + + metadata { + namespace = "%s" + } + + spec { + container { + image = "gcr.io/cloudrun/hello" + args = ["arrgs"] + } + container_concurrency = %s + } +} +`, name, project, concurrency) +}