Skip to content

Commit

Permalink
add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Sun committed Feb 19, 2023
1 parent ad1654a commit 94665df
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,29 @@ func TestAccComputeRegionBackendService_withBackendAndIAP(t *testing.T) {
})
}

func TestAccComputeRegionBackendService_UDPFailOverPolicy(t *testing.T) {
t.Parallel()

serviceName := fmt.Sprintf("tf-test-%s", randString(t, 10))
checkName := fmt.Sprintf("tf-test-%s", randString(t, 10))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccComputeRegionBackendService_UDPFailOverPolicy(serviceName, checkName),
},
{
ResourceName: "google_compute_region_backend_service.foobar",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

<% unless version == 'ga' -%>
func TestAccComputeRegionBackendService_subsettingUpdate(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -501,6 +524,31 @@ resource "google_compute_health_check" "health_check" {
}
<% end -%>

func testAccComputeRegionBackendService_UDPFailOverPolicy(serviceName, checkName string) string {
return fmt.Sprintf(`
resource "google_compute_region_backend_service" "foobar" {
name = "%s"
health_checks = [google_compute_health_check.zero.self_link]
region = "us-central1"

protocol = "UDP"
failover_policy {
drop_traffic_if_unhealthy = true
}
}

resource "google_compute_health_check" "zero" {
name = "%s"
check_interval_sec = 1
timeout_sec = 1

tcp_health_check {
port = "80"
}
}
`, serviceName, checkName)
}

func testAccComputeRegionBackendService_basic(serviceName, checkName string) string {
return fmt.Sprintf(`
resource "google_compute_region_backend_service" "foobar" {
Expand Down

0 comments on commit 94665df

Please sign in to comment.