summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarnonsan <arnon.san@cpf.co.th>2022-12-17 16:17:14 +0700
committerGitHub <noreply@github.com>2022-12-17 16:17:14 +0700
commit758e69ad01520d71582c748c3e83ebf028595adf (patch)
tree6760095bb6fe8511cf9e2739bb4524e1f988347d
parent982f9798fc394bdc8c1fd3e3dba41ed9294a2af3 (diff)
test: added RequiresImportErrorStep
-rw-r--r--azuredevops/internal/acceptancetests/resource_serviceendpoint_externaltfs_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/azuredevops/internal/acceptancetests/resource_serviceendpoint_externaltfs_test.go b/azuredevops/internal/acceptancetests/resource_serviceendpoint_externaltfs_test.go
index 6ee6f16a..ba93fbde 100644
--- a/azuredevops/internal/acceptancetests/resource_serviceendpoint_externaltfs_test.go
+++ b/azuredevops/internal/acceptancetests/resource_serviceendpoint_externaltfs_test.go
@@ -118,6 +118,30 @@ func TestAccServiceEndpointExternalTFS_CreateAndUpdate(t *testing.T) {
})
}
+func TestAccServiceEndpointExternalTFS_RequiresImportErrorStep(t *testing.T) {
+ projectName := testutils.GenerateResourceName()
+ serviceEndpointName := testutils.GenerateResourceName()
+ resourceType := "azuredevops_serviceendpoint_externaltfs"
+ tfSvcEpNode := resourceType + ".serviceendpoint"
+ resource.ParallelTest(t, resource.TestCase{
+ PreCheck: func() { testutils.PreCheck(t, nil) },
+ Providers: testutils.GetProviders(),
+ CheckDestroy: testutils.CheckServiceEndpointDestroyed(resourceType),
+ Steps: []resource.TestStep{
+ {
+ Config: hclSvcEndpointExternalTFSResourceBasic(projectName, serviceEndpointName),
+ Check: resource.ComposeTestCheckFunc(
+ testutils.CheckServiceEndpointExistsWithName(tfSvcEpNode, serviceEndpointName),
+ ),
+ },
+ {
+ Config: hclSvcEndpointExternalTFSResourceRequiresImport(projectName, serviceEndpointName),
+ ExpectError: testutils.RequiresImportError(serviceEndpointName),
+ },
+ },
+ })
+}
+
func hclSvcEndpointExternalTFSResourceBasic(projectName string, serviceEndpointName string) string {
projectResource := testutils.HclProjectResource(projectName)
serviceEndpointResource := fmt.Sprintf(`
@@ -146,3 +170,18 @@ resource "azuredevops_serviceendpoint_externaltfs" "serviceendpoint" {
}`, serviceEndpointName, description)
return fmt.Sprintf("%s\n%s", projectResource, serviceEndpointResource)
}
+
+func hclSvcEndpointExternalTFSResourceRequiresImport(projectName string, serviceEndpointName string) string {
+ template := hclSvcEndpointExternalTFSResourceBasic(projectName, serviceEndpointName)
+ return fmt.Sprintf(`
+%s
+resource "azuredevops_serviceendpoint_externaltfs" "import" {
+ project_id = azuredevops_serviceendpoint_externaltfs.serviceendpoint.project_id
+ service_endpoint_name = azuredevops_serviceendpoint_externaltfs.serviceendpoint.service_endpoint_name
+ connection_url = azuredevops_serviceendpoint_externaltfs.serviceendpoint.connection_url
+ auth_personal {
+ personal_access_token = "test_token_basic"
+ }
+}
+`, template)
+}