Skip to content

Commit

Permalink
Update acceptance tests.
Browse files Browse the repository at this point in the history
Signed-off-by: stack72 <[email protected]>
  • Loading branch information
Robert Rudduck authored and stack72 committed Jun 15, 2017
1 parent 85a9cbc commit 232c341
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions azurerm/resource_arm_traffic_manager_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,32 @@ func TestAccAzureRMTrafficManagerEndpoint_nestedEndpoints(t *testing.T) {
})
}

func TestAccAzureRMTrafficManagerEndpoint_location(t *testing.T) {
ri := acctest.RandInt()
first := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_location, ri, ri, ri, ri)
second := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_locationUpdated, ri, ri, ri, ri)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMTrafficManagerEndpointDestroy,
Steps: []resource.TestStep{
{
Config: first,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.test"),
),
},
{
Config: second,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.test"),
),
},
},
})
}

func testCheckAzureRMTrafficManagerEndpointExists(name string) resource.TestCheckFunc {
return func(s *terraform.State) error {
// Ensure we have enough information in state to look up in API
Expand Down Expand Up @@ -589,3 +615,69 @@ resource "azurerm_traffic_manager_endpoint" "externalChild" {
resource_group_name = "${azurerm_resource_group.test.name}"
}
`

var testAccAzureRMTrafficManagerEndpoint_location = `
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_traffic_manager_profile" "test" {
name = "acctesttmpparent%d"
resource_group_name = "${azurerm_resource_group.test.name}"
traffic_routing_method = "Performance"
dns_config {
relative_name = "acctestparent%d"
ttl = 30
}
monitor_config {
protocol = "https"
port = 443
path = "/"
}
}
resource "azurerm_traffic_manager_endpoint" "test" {
name = "acctestend-external%d"
type = "externalEndpoints"
target = "terraform.io"
endpoint_location = "${azurerm_resource_group.test.location}"
profile_name = "${azurerm_traffic_manager_profile.test.name}"
resource_group_name = "${azurerm_resource_group.test.name}"
}
`

var testAccAzureRMTrafficManagerEndpoint_locationUpdated = `
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "westus"
}
resource "azurerm_traffic_manager_profile" "test" {
name = "acctesttmpparent%d"
resource_group_name = "${azurerm_resource_group.test.name}"
traffic_routing_method = "Performance"
dns_config {
relative_name = "acctestparent%d"
ttl = 30
}
monitor_config {
protocol = "https"
port = 443
path = "/"
}
}
resource "azurerm_traffic_manager_endpoint" "test" {
name = "acctestend-external%d"
type = "externalEndpoints"
target = "terraform.io"
endpoint_location = "${azurerm_resource_group.test.location}"
profile_name = "${azurerm_traffic_manager_profile.test.name}"
resource_group_name = "${azurerm_resource_group.test.name}"
}
`

0 comments on commit 232c341

Please sign in to comment.