Skip to content

Commit

Permalink
azurerm_iotcentral_organization - remove acctests on ForceNew pro…
Browse files Browse the repository at this point in the history
…perty (#27618)

* `azurerm_iotcentral_organization` - remove acctests on `ForceNew` property

* CI
  • Loading branch information
ziyeqf authored Oct 17, 2024
1 parent a38b708 commit f9d8bc8
Showing 1 changed file with 0 additions and 114 deletions.
114 changes: 0 additions & 114 deletions internal/services/iotcentral/iotcentral_organization_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,75 +77,6 @@ func TestAccIoTCentralOrganization_updateDisplayName(t *testing.T) {
})
}

func TestAccIoTCentralOrganization_setParent(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_iotcentral_organization", "test")
r := IoTCentralOrganizationResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("parent_organization_id").IsEmpty(),
),
},
{
Config: r.complete(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("parent_organization_id").IsNotEmpty(),
),
},
data.ImportStep(),
})
}

func TestAccIoTCentralOrganization_updateParent(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_iotcentral_organization", "test")
r := IoTCentralOrganizationResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.complete(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("parent_organization_id").IsNotEmpty(),
),
},
{
Config: r.completeUpdateParent(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("parent_organization_id").IsNotEmpty(),
),
},
data.ImportStep(),
})
}

func TestAccIoTCentralOrganization_unsetParent(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_iotcentral_organization", "test")
r := IoTCentralOrganizationResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.complete(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("parent_organization_id").IsNotEmpty(),
),
},
{
Config: r.completeUnsetParent(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("parent_organization_id").IsEmpty(),
),
},
data.ImportStep(),
})
}

func (IoTCentralOrganizationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := parse.OrganizationID(state.ID)
if err != nil {
Expand Down Expand Up @@ -224,51 +155,6 @@ resource "azurerm_iotcentral_organization" "test" {
`, r.template(data))
}

func (r IoTCentralOrganizationResource) completeUpdateParent(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
%s
resource "azurerm_iotcentral_organization" "test_parent" {
iotcentral_application_id = azurerm_iotcentral_application.test.id
organization_id = "org-test-parent-id"
display_name = "Org parent"
}
resource "azurerm_iotcentral_organization" "test_parent_2" {
iotcentral_application_id = azurerm_iotcentral_application.test.id
organization_id = "org-test-parent-2-id"
display_name = "Org parent 2"
}
resource "azurerm_iotcentral_organization" "test" {
iotcentral_application_id = azurerm_iotcentral_application.test.id
organization_id = "org-test-id"
display_name = "Org child"
parent_organization_id = azurerm_iotcentral_organization.test_parent_2.organization_id
}
`, r.template(data))
}

func (r IoTCentralOrganizationResource) completeUnsetParent(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
%s
resource "azurerm_iotcentral_organization" "test_parent" {
iotcentral_application_id = azurerm_iotcentral_application.test.id
organization_id = "org-test-parent-id"
display_name = "Org parent"
}
resource "azurerm_iotcentral_organization" "test" {
iotcentral_application_id = azurerm_iotcentral_application.test.id
organization_id = "org-test-id"
display_name = "Org child"
}
`, r.template(data))
}

func (IoTCentralOrganizationResource) template(data acceptance.TestData) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
Expand Down

0 comments on commit f9d8bc8

Please sign in to comment.