Skip to content

Commit

Permalink
added empty list test
Browse files Browse the repository at this point in the history
  • Loading branch information
jkroepke committed Jun 4, 2024
1 parent dcba883 commit 118ccc1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ func TestAccCommunicationService_update(t *testing.T) {
data.ImportStep(),
{
Config: r.update(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("linked_domains").DoesNotExist(),
),
},
data.ImportStep(),
})
}

func TestAccCommunicationService_linkedDomainsEmpty(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_communication_service", "test")
r := CommunicationServiceTestResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.emptyLinkedDomains(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
Expand Down Expand Up @@ -178,6 +194,23 @@ resource "azurerm_communication_service" "test" {
`, r.template(data), data.RandomInteger)
}

func (r CommunicationServiceTestResource) emptyLinkedDomains(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
resource "azurerm_communication_service" "test" {
name = "acctest-CommunicationService-%d"
resource_group_name = azurerm_resource_group.test.name
data_location = "United States"
linked_domains = []
tags = {
env = "Test2"
}
}
`, r.template(data), data.RandomInteger)
}

func (r CommunicationServiceTestResource) template(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func (EmailCommunicationServiceDomainResource) Arguments() map[string]*pluginsdk
"user_engagement_tracking_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: false,
},

"tags": commonschema.Tags(),
Expand Down

0 comments on commit 118ccc1

Please sign in to comment.