Skip to content

Commit

Permalink
add test for auto_grow property
Browse files Browse the repository at this point in the history
  • Loading branch information
r0bnet committed Sep 12, 2019
1 parent a0d2856 commit e38e5a2
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions azurerm/resource_arm_mysql_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,36 @@ func TestAccAzureRMMySQLServer_updateSKU(t *testing.T) {
})
}

func TestAccAzureRMMySQLServer_storageAutogrow(t *testing.T) {
resourceName := "azurerm_mysql_server.test"
ri := tf.AccRandTimeInt()
location := testLocation()
config := testAccAzureRMMySQLServer_basicFiveSeven(ri, location)
updatedConfig := testAccAzureRMMySQLServer_autogrow(ri, location)

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMMySQLServerDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMMySQLServerExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "storage_profile.0.auto_grow", "Enabled"),
),
},
{
Config: updatedConfig,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMMySQLServerExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "storage_profile.0.auto_grow", "Disabled"),
),
},
},
})
}

//

func testCheckAzureRMMySQLServerExists(resourceName string) resource.TestCheckFunc {
Expand Down Expand Up @@ -522,3 +552,37 @@ resource "azurerm_mysql_server" "test" {
}
`, rInt, location, rInt)
}

func testAccAzureRMMySQLServer_autogrow(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}
resource "azurerm_mysql_server" "test" {
name = "acctestmysqlsvr-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku {
name = "GP_Gen5_2"
capacity = 2
tier = "GeneralPurpose"
family = "Gen5"
}
storage_profile {
storage_mb = 51200
backup_retention_days = 7
geo_redundant_backup = "Disabled"
auto_grow = "Disabled"
}
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
version = "5.7"
ssl_enforcement = "Enabled"
}
`, rInt, location, rInt)
}

0 comments on commit e38e5a2

Please sign in to comment.