Skip to content

Commit

Permalink
Splitting password change out into it's own method
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed May 22, 2018
1 parent da00537 commit f9db21a
Showing 1 changed file with 65 additions and 4 deletions.
69 changes: 65 additions & 4 deletions azurerm/resource_arm_postgresql_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,35 @@ func TestAccAzureRMPostgreSQLServer_updatePassword(t *testing.T) {
ri := acctest.RandInt()
location := testLocation()
config := testAccAzureRMPostgreSQLServer_basicNinePointSix(ri, location)
updatedConfig := testAccAzureRMPostgreSQLServer_basicNinePointSixUpdated(ri, location)
updatedConfig := testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedPassword(ri, location)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMPostgreSQLServerDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMPostgreSQLServerExists(resourceName),
),
},
{
Config: updatedConfig,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMPostgreSQLServerExists(resourceName),
),
},
},
})
}

func TestAccAzureRMPostgreSQLServer_updatePassword(t *testing.T) {
resourceName := "azurerm_postgresql_server.test"
ri := acctest.RandInt()
location := testLocation()
config := testAccAzureRMPostgreSQLServer_basicNinePointSix(ri, location)
updatedConfig := testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedSKU(ri, location)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down Expand Up @@ -271,7 +299,7 @@ resource "azurerm_postgresql_server" "test" {
`, rInt, location, rInt)
}

func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdated(rInt int, location string) string {
func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedPassword(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
Expand All @@ -284,8 +312,8 @@ resource "azurerm_postgresql_server" "test" {
resource_group_name = "${azurerm_resource_group.test.name}"
sku {
name = "B_Gen4_1"
capacity = 1
name = "B_Gen4_2"
capacity = 2
tier = "Basic"
family = "Gen4"
}
Expand All @@ -305,6 +333,39 @@ resource "azurerm_postgresql_server" "test" {
`, rInt, location, rInt)
}

func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedSKU(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}
resource "azurerm_postgresql_server" "test" {
name = "acctestpsqlsvr-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku {
name = "B_Gen4_1"
capacity = 1
tier = "Basic"
family = "Gen4"
}
storage_profile {
storage_mb = 51200
backup_retention_days = 7
geo_redundant_backup = "Disabled"
}
administrator_login = "acctestun"
administrator_login_password = "H@Sh1CoR3!"
version = "9.6"
ssl_enforcement = "Enabled"
}
`, rInt, location, rInt)
}

func testAccAzureRMPostgreSQLServer_basicMaxStorage(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
Expand Down

0 comments on commit f9db21a

Please sign in to comment.