Skip to content

Commit

Permalink
extra function version test
Browse files Browse the repository at this point in the history
  • Loading branch information
Aris van Ommeren committed May 5, 2020
1 parent 9e8bc29 commit bd17edd
Showing 1 changed file with 76 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,32 @@ func TestAccAzureRMFunctionAppSlot_updateManageServiceIdentity(t *testing.T) {
})
}

func TestAccAzureRMFunctionAppSlot_updateVersion(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_function_app_slot", "test")

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acceptance.PreCheck(t) },
Providers: acceptance.SupportedProviders,
CheckDestroy: testCheckAzureRMFunctionAppDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMFunctionAppSlot_version(data, "~1"),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMFunctionAppSlotExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "version", "~1"),
),
},
{
Config: testAccAzureRMFunctionAppSlot_version(data, "~2"),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMFunctionAppSlotExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "version", "~2"),
),
},
},
})
}

func TestAccAzureRMFunctionAppSlot_userAssignedIdentity(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_function_app_slot", "test")

Expand Down Expand Up @@ -1798,6 +1824,56 @@ resource "azurerm_function_app_slot" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomString, data.RandomInteger, data.RandomInteger)
}

func testAccAzureRMFunctionAppSlot_version(data acceptance.TestData, version string) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}
resource "azurerm_app_service_plan" "test" {
name = "acctestASP-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_storage_account" "test" {
name = "acctestsa%s"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_function_app" "test" {
name = "acctestFA-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
app_service_plan_id = azurerm_app_service_plan.test.id
storage_connection_string = azurerm_storage_account.test.primary_connection_string
}
resource "azurerm_function_app_slot" "test" {
name = "acctestFASlot-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
app_service_plan_id = azurerm_app_service_plan.test.id
function_app_name = azurerm_function_app.test.name
storage_connection_string = azurerm_storage_account.test.primary_connection_string
version = "%s"
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomString, data.RandomInteger, data.RandomInteger, version)
}

func testAccAzureRMFunctionAppSlot_userAssignedIdentity(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down

0 comments on commit bd17edd

Please sign in to comment.