Skip to content

Commit

Permalink
managementgroup - fix TestAccManagementGroup_updateName recreate (#…
Browse files Browse the repository at this point in the history
…27517)

* fix TestAccManagementGroup_updateName recreate

* fix lint
  • Loading branch information
teowa authored Oct 2, 2024
1 parent b70c831 commit cede20d
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func TestAccManagementGroup_withName(t *testing.T) {
})
}

func TestAccManagementGroup_updateName(t *testing.T) {
func TestAccManagementGroup_updateDisplayName(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_management_group", "test")
r := ManagementGroupResource{}

Expand All @@ -145,10 +145,10 @@ func TestAccManagementGroup_updateName(t *testing.T) {
),
},
{
Config: r.withName(data),
Config: r.withDisplayName(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("name").HasValue(fmt.Sprintf("acctestmg-%d", data.RandomInteger)),
check.That(data.ResourceName).Key("display_name").HasValue(fmt.Sprintf("accTestMG-%d", data.RandomInteger)),
),
},
data.ImportStep(),
Expand Down Expand Up @@ -275,6 +275,18 @@ resource "azurerm_management_group" "test" {
`, data.RandomInteger, data.RandomInteger)
}

func (ManagementGroupResource) withDisplayName(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_management_group" "test" {
display_name = "accTestMG-%d"
}
`, data.RandomInteger)
}

// TODO: switch this out for dynamically creating a subscription once that's supported in the future
func (r ManagementGroupResource) withSubscriptions(subscriptionID string) string {
return fmt.Sprintf(`
Expand Down

0 comments on commit cede20d

Please sign in to comment.