From cede20d3a8006c86144a7d6ec6dc8ed74158b067 Mon Sep 17 00:00:00 2001 From: Tao <104055472+teowa@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:15:44 +0800 Subject: [PATCH] `managementgroup` - fix `TestAccManagementGroup_updateName` recreate (#27517) * fix TestAccManagementGroup_updateName recreate * fix lint --- .../management_group_resource_test.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/internal/services/managementgroup/management_group_resource_test.go b/internal/services/managementgroup/management_group_resource_test.go index 57a4ef2fd912..6fd20a90c082 100644 --- a/internal/services/managementgroup/management_group_resource_test.go +++ b/internal/services/managementgroup/management_group_resource_test.go @@ -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{} @@ -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(), @@ -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(`