|
| 1 | +package google |
| 2 | + |
| 3 | +import ( |
| 4 | + "fmt" |
| 5 | + "testing" |
| 6 | + |
| 7 | + "github.com/hashicorp/terraform/helper/acctest" |
| 8 | + "github.com/hashicorp/terraform/helper/resource" |
| 9 | +) |
| 10 | + |
| 11 | +func TestAccCloudrunService_cloudrunServiceUpdate(t *testing.T) { |
| 12 | + t.Parallel() |
| 13 | + |
| 14 | + project := getTestProjectFromEnv() |
| 15 | + name := "tftest-cloudrun-" + acctest.RandString(6) |
| 16 | + |
| 17 | + resource.Test(t, resource.TestCase{ |
| 18 | + PreCheck: func() { testAccPreCheck(t) }, |
| 19 | + Providers: testAccProviders, |
| 20 | + Steps: []resource.TestStep{ |
| 21 | + { |
| 22 | + Config: testAccCloudrunService_cloudrunServiceUpdate(name, project, "10"), |
| 23 | + }, |
| 24 | + { |
| 25 | + ResourceName: "google_cloudrun_service.default", |
| 26 | + ImportStateId: "us-central1/" + name, |
| 27 | + ImportState: true, |
| 28 | + ImportStateVerify: true, |
| 29 | + ImportStateVerifyIgnore: []string{"metadata.0.resource_version"}, |
| 30 | + }, |
| 31 | + { |
| 32 | + Config: testAccCloudrunService_cloudrunServiceUpdate(name, project, "50"), |
| 33 | + }, |
| 34 | + { |
| 35 | + ResourceName: "google_cloudrun_service.default", |
| 36 | + ImportStateId: "us-central1/" + name, |
| 37 | + ImportState: true, |
| 38 | + ImportStateVerify: true, |
| 39 | + ImportStateVerifyIgnore: []string{"metadata.0.resource_version"}, |
| 40 | + }, |
| 41 | + }, |
| 42 | + }) |
| 43 | +} |
| 44 | + |
| 45 | +func testAccCloudrunService_cloudrunServiceUpdate(name, project, concurrency string) string { |
| 46 | + return fmt.Sprintf(` |
| 47 | +resource "google_cloudrun_service" "default" { |
| 48 | + name = "%s" |
| 49 | + location = "us-central1" |
| 50 | +
|
| 51 | + metadata { |
| 52 | + namespace = "%s" |
| 53 | + } |
| 54 | +
|
| 55 | + spec { |
| 56 | + container { |
| 57 | + image = "gcr.io/cloudrun/hello" |
| 58 | + args = ["arrgs"] |
| 59 | + } |
| 60 | + container_concurrency = %s |
| 61 | + } |
| 62 | +} |
| 63 | +`, name, project, concurrency) |
| 64 | +} |
0 commit comments