Skip to content

Commit

Permalink
Test import of Synapse Private Link Hub
Browse files Browse the repository at this point in the history
Signed-off-by: Owen Farrell <[email protected]>
  • Loading branch information
owenfarrell committed Jul 15, 2021
1 parent 94b43c8 commit 364188d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions azurerm/internal/services/synapse/synapse_private_link_hub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ func TestAccSynapsePrivateLinkHub_basic(t *testing.T) {
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

func TestAccSynapsePrivateLinkHub_requiresImport(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_synapse_private_link_hub", "test")
r := SynapsePrivateLinkHubResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.RequiresImportErrorStep(r.requiresImport),
})
}

Expand Down Expand Up @@ -81,6 +97,19 @@ resource "azurerm_synapse_private_link_hub" "test" {
`, template, data.RandomInteger)
}

func (r SynapsePrivateLinkHubResource) requiresImport(data acceptance.TestData) string {
config := r.basic(data)
return fmt.Sprintf(`
%s
resource "azurerm_synapse_private_link_hub" "import" {
name = azurerm_synapse_private_link_hub.test.name
resource_group_name = azurerm_synapse_private_link_hub.test.resource_group_name
location = azurerm_synapse_private_link_hub.test.location
}
`, config)
}

func (r SynapsePrivateLinkHubResource) withUpdateFields(data acceptance.TestData) string {
template := r.template(data)
return fmt.Sprintf(`
Expand Down

0 comments on commit 364188d

Please sign in to comment.