provider/azurerm Completed test TestAccAzureRMSqlDatabase_elasticPool to verify creating a SQL database in an SQL elastic pool

This commit is contained in:
Dominik Lekse 2017-05-02 14:50:32 +02:00
parent f41594952e
commit 8491fb9498
1 changed files with 15 additions and 4 deletions

View File

@ -67,7 +67,7 @@ func TestAccAzureRMSqlDatabase_basic(t *testing.T) {
func TestAccAzureRMSqlDatabase_elasticPool(t *testing.T) { func TestAccAzureRMSqlDatabase_elasticPool(t *testing.T) {
ri := acctest.RandInt() ri := acctest.RandInt()
config := fmt.Sprintf(testAccAzureRMSqlDatabase_elasticPool, ri, ri, ri) config := fmt.Sprintf(testAccAzureRMSqlDatabase_elasticPool, ri, ri, ri, ri)
resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) }, PreCheck: func() { testAccPreCheck(t) },
@ -78,7 +78,7 @@ func TestAccAzureRMSqlDatabase_elasticPool(t *testing.T) {
Config: config, Config: config,
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testCheckAzureRMSqlDatabaseExists("azurerm_sql_database.test"), testCheckAzureRMSqlDatabaseExists("azurerm_sql_database.test"),
resource.TestCheckResourceAttr("azurerm_sql_database.test", "elastic_pool_name", "test_ep"), resource.TestCheckResourceAttr("azurerm_sql_database.test", "elastic_pool_name", fmt.Sprintf("acctestep%d", ri)),
), ),
}, },
}, },
@ -188,6 +188,7 @@ resource "azurerm_resource_group" "test" {
name = "acctestRG_%d" name = "acctestRG_%d"
location = "West US" location = "West US"
} }
resource "azurerm_sql_server" "test" { resource "azurerm_sql_server" "test" {
name = "acctestsqlserver%d" name = "acctestsqlserver%d"
resource_group_name = "${azurerm_resource_group.test.name}" resource_group_name = "${azurerm_resource_group.test.name}"
@ -197,15 +198,25 @@ resource "azurerm_sql_server" "test" {
administrator_login_password = "thisIsDog11" administrator_login_password = "thisIsDog11"
} }
resource "azurerm_sql_elasticpool" "test" {
name = "acctestep%d"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "West US"
server_name = "${azurerm_sql_server.test.name}"
edition = "Basic"
dtu = 50
pool_size = 5000
}
resource "azurerm_sql_database" "test" { resource "azurerm_sql_database" "test" {
name = "acctestdb%d" name = "acctestdb%d"
resource_group_name = "${azurerm_resource_group.test.name}" resource_group_name = "${azurerm_resource_group.test.name}"
server_name = "${azurerm_sql_server.test.name}" server_name = "${azurerm_sql_server.test.name}"
location = "West US" location = "West US"
edition = "Standard" edition = "${azurerm_sql_elasticpool.test.edition}"
collation = "SQL_Latin1_General_CP1_CI_AS" collation = "SQL_Latin1_General_CP1_CI_AS"
max_size_bytes = "1073741824" max_size_bytes = "1073741824"
elastic_pool_name = "test_ep" elastic_pool_name = "${azurerm_sql_elasticpool.test.name}"
requested_service_objective_name = "ElasticPool" requested_service_objective_name = "ElasticPool"
} }
` `