From 62d1d7173a54df6ff51868fe021eba961a14a7b2 Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Wed, 22 Apr 2020 11:25:11 +0200 Subject: [PATCH] Add test for defaultUrlRedirect --- ...esource_compute_region_url_map_test.go.erb | 33 +++++++++++++++++++ .../resource_compute_url_map_test.go.erb | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/third_party/terraform/tests/resource_compute_region_url_map_test.go.erb b/third_party/terraform/tests/resource_compute_region_url_map_test.go.erb index bf64e4a2dd45..92844d4b1609 100644 --- a/third_party/terraform/tests/resource_compute_region_url_map_test.go.erb +++ b/third_party/terraform/tests/resource_compute_region_url_map_test.go.erb @@ -160,6 +160,28 @@ func TestAccComputeRegionUrlMap_ilbRouteUpdate(t *testing.T) { }) } +func TestAccComputeRegionUrlMap_defaultUrlRedirect(t *testing.T) { + t.Parallel() + + randomSuffix := randString(t, 10) + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccComputeRegionUrlMap_defaultUrlRedirectConfig(randomSuffix), + }, + { + ResourceName: "google_compute_region_url_map.foobar", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccComputeRegionUrlMap_basic1(randomSuffix string) string { return fmt.Sprintf(` resource "google_compute_region_backend_service" "foobar" { @@ -822,4 +844,15 @@ resource "google_compute_region_health_check" "default" { } `, randomSuffix, randomSuffix, randomSuffix, randomSuffix) } + +func testAccComputeRegionUrlMap_defaultUrlRedirectConfig(randomSuffix string) string { + return fmt.Sprintf(` +resource "google_compute_region_url_map" "foobar" { + name = "urlmap-test-%s" + default_url_redirect { + https_redirect = true + } +} +`, randomSuffix) +} <% end -%> diff --git a/third_party/terraform/tests/resource_compute_url_map_test.go.erb b/third_party/terraform/tests/resource_compute_url_map_test.go.erb index c6dc1b2a7402..611bfa78b30b 100644 --- a/third_party/terraform/tests/resource_compute_url_map_test.go.erb +++ b/third_party/terraform/tests/resource_compute_url_map_test.go.erb @@ -221,6 +221,28 @@ func TestAccComputeUrlMap_trafficDirectorRemoveRouteRule(t *testing.T) { }) } +func TestAccComputeUrlMap_defaultUrlRedirect(t *testing.T) { + t.Parallel() + + randomSuffix := randString(t, 10) + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckComputeUrlMapDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccComputeUrlMap_defaultUrlRedirectConfig(randomSuffix), + }, + { + ResourceName: "google_compute_url_map.foobar", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccComputeUrlMap_basic1(bsName, hcName, umName string) string { return fmt.Sprintf(` resource "google_compute_backend_service" "foobar" { @@ -941,3 +963,14 @@ resource "google_compute_health_check" "default" { } `, umName, bsName, bsName, hcName) } + +func testAccComputeUrlMap_defaultUrlRedirectConfig(randomSuffix string) string { + return fmt.Sprintf(` +resource "google_compute_url_map" "foobar" { + name = "urlmap-test-%s" + default_url_redirect { + https_redirect = true + } +} +`, randomSuffix) +}