Skip to content

Commit

Permalink
Clean up test configs, update deprecated attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed May 11, 2020
1 parent 3bafdd4 commit da1043a
Showing 1 changed file with 34 additions and 33 deletions.
67 changes: 34 additions & 33 deletions azurerm/internal/services/mysql/tests/mysql_server_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,22 +305,23 @@ func TestAccAzureRMMySQLServer_createReplica(t *testing.T) {
func TestAccAzureRMMySQLServer_createPointInTimeRestore(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_mysql_server", "test")
restoreTime := time.Now().Add(11 * time.Minute)
mysqlVersion := "8.0"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acceptance.PreCheck(t) },
Providers: acceptance.SupportedProviders,
CheckDestroy: testCheckAzureRMMySQLServerDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMMySQLServer_basic(data, "8.0"),
Config: testAccAzureRMMySQLServer_basic(data, mysqlVersion),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMMySQLServerExists(data.ResourceName),
),
},
data.ImportStep("administrator_login_password"),
{
PreConfig: func() { time.Sleep(restoreTime.Sub(time.Now().Add(-7 * time.Minute))) },
Config: testAccAzureRMMySQLServer_createPointInTimeRestore(data, "8.0", restoreTime.Format(time.RFC3339)),
Config: testAccAzureRMMySQLServer_createPointInTimeRestore(data, mysqlVersion, restoreTime.Format(time.RFC3339)),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMMySQLServerExists(data.ResourceName),
testCheckAzureRMMySQLServerExists("azurerm_mysql_server.restore"),
Expand Down Expand Up @@ -511,19 +512,15 @@ resource "azurerm_mysql_server" "import" {
name = azurerm_mysql_server.test.name
location = azurerm_mysql_server.test.location
resource_group_name = azurerm_mysql_server.test.resource_group_name
sku_name = "GP_Gen5_2"
storage_profile {
storage_mb = 51200
backup_retention_days = 7
geo_redundant_backup = "Disabled"
}
sku_name = "GP_Gen5_2"
version = "5.7"
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
version = "5.7"
ssl_enforcement = "Enabled"
backup_retention_days = 7
geo_redundant_backup_enabled = false
ssl_enforcement_enabled = true
storage_mb = 51200
}
`, testAccAzureRMMySQLServer_basic(data, "5.7"))
}
Expand All @@ -540,15 +537,16 @@ resource "azurerm_resource_group" "test" {
}
resource "azurerm_mysql_server" "test" {
name = "acctestmysqlsvr-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "%s"
name = "acctestmysqlsvr-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "%s"
version = "5.7"
storage_mb = 4194304
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
version = "5.7"
ssl_enforcement = "Enabled"
ssl_enforcement_enabled = true
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, sku)
}
Expand All @@ -565,18 +563,19 @@ resource "azurerm_resource_group" "test" {
}
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"
name = "acctestmysqlsvr-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "GP_Gen5_2"
version = "%s"
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
auto_grow_enabled = true
backup_retention_days = 7
geo_redundant_backup_enabled = false
ssl_enforcement_enabled = true
storage_mb = 51200
version = "%s"
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, version)
}
Expand All @@ -586,14 +585,15 @@ func testAccAzureRMMySQLServer_createReplica(data acceptance.TestData, version s
%s
resource "azurerm_mysql_server" "replica" {
name = "acctestmysqlsvr-%d-replica"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "GP_Gen5_2"
name = "acctestmysqlsvr-%d-replica"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "GP_Gen5_2"
version = "%s"
create_mode = "Replica"
creation_source_server_id = azurerm_mysql_server.test.id
ssl_enforcement_enabled = true
version = "%s"
}
`, testAccAzureRMMySQLServer_basic(data, version), data.RandomInteger, version)
}
Expand All @@ -603,16 +603,17 @@ func testAccAzureRMMySQLServer_createPointInTimeRestore(data acceptance.TestData
%s
resource "azurerm_mysql_server" "restore" {
name = "acctestmysqlsvr-%d-restore"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "GP_Gen5_2"
name = "acctestmysqlsvr-%d-restore"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "GP_Gen5_2"
version = "%s"
create_mode = "PointInTimeRestore"
creation_source_server_id = azurerm_mysql_server.test.id
restore_point_in_time = "%s"
ssl_enforcement_enabled = true
storage_mb = 51200
version = "%s"
}
`, testAccAzureRMMySQLServer_basic(data, version), data.RandomInteger, restoreTime, version)
}

0 comments on commit da1043a

Please sign in to comment.