diff --git a/internal/providers/sdkv2/sdkv2.go b/internal/providers/sdkv2/sdkv2.go index 8136901ddf..2475873d05 100644 --- a/internal/providers/sdkv2/sdkv2.go +++ b/internal/providers/sdkv2/sdkv2.go @@ -149,6 +149,7 @@ func DatabricksProvider() *schema.Provider { "databricks_external_location": catalog.ResourceExternalLocation().ToResource(), "databricks_file": storage.ResourceFile().ToResource(), "databricks_git_credential": repos.ResourceGitCredential().ToResource(), + "databricks_git_folder": repos.ResourceGitFolder().ToResource(), "databricks_global_init_script": workspace.ResourceGlobalInitScript().ToResource(), "databricks_grant": catalog.ResourceGrant().ToResource(), "databricks_grants": catalog.ResourceGrants().ToResource(), diff --git a/repos/resource_git_folder.go b/repos/resource_git_folder.go new file mode 100644 index 0000000000..713c6515e3 --- /dev/null +++ b/repos/resource_git_folder.go @@ -0,0 +1,157 @@ +package repos + +import ( + "context" + "fmt" + "net/url" + "regexp" + "strconv" + "strings" + + "github.com/databricks/databricks-sdk-go/service/workspace" + "github.com/databricks/terraform-provider-databricks/common" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +type gitFolderStruct workspace.RepoInfo + +var aliasMap = map[string]string{ + "provider": "git_provider", +} + +func (s gitFolderStruct) Aliases() map[string]map[string]string { + return map[string]map[string]string{ + "repos.gitFolderStruct": { + "provider": "git_provider", + }, + } +} + +type gitFolderCreateStruct workspace.CreateRepoRequest + +func (s gitFolderCreateStruct) Aliases() map[string]map[string]string { + return map[string]map[string]string{ + "repos.gitFolderStruct": { + "provider": "git_provider", + }, + } +} + +func (s gitFolderCreateStruct) CustomizeSchema(m *common.CustomizableSchema) *common.CustomizableSchema { + return m +} + +type gitFolderUpdateStruct workspace.UpdateRepoRequest + +func (s gitFolderUpdateStruct) Aliases() map[string]map[string]string { + return map[string]map[string]string{ + "repos.gitFolderStruct": { + "provider": "git_provider", + }, + } +} + +func (s gitFolderUpdateStruct) CustomizeSchema(m *common.CustomizableSchema) *common.CustomizableSchema { + return m +} + +var ( + gitProvidersMap = map[string]string{ + "github.com": "gitHub", + "dev.azure.com": "azureDevOpsServices", + "gitlab.com": "gitLab", + "bitbucket.org": "bitbucketCloud", + } + awsCodeCommitRegex = regexp.MustCompile(`^git-codecommit\.[^.]+\.amazonaws\.com$`) +) + +func ResourceGitFolder() common.Resource { + s := common.StructToSchema(gitFolderStruct{}, func(s map[string]*schema.Schema) map[string]*schema.Schema { + s["provider"].DiffSuppressFunc = common.EqualFoldDiffSuppress + delete(s, "id") + return s + }) + return common.Resource{ + Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error { + var create gitFolderCreateStruct + if create.Provider == "" { // trying to infer Git Provider from the URL + create.Provider = GetGitProviderFromUrl(create.Url) + } + if create.Provider == "" { + return fmt.Errorf("git_provider isn't specified and we can't detect provider from URL") + } + common.DataToStructPointer(d, s, &create) + ws, err := c.WorkspaceClient() + if err != nil { + return err + } + repo, err := ws.Repos.Create(ctx, workspace.CreateRepoRequest{ + Path: create.Path, + Provider: create.Provider, + SparseCheckout: create.SparseCheckout, + Url: create.Url, + }) + if err != nil { + return err + } + d.Set("id", repo.Id) + common.StructToData(repo, s, d) + return nil + }, + Read: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error { + ws, err := c.WorkspaceClient() + if err != nil { + return err + } + id, err := strconv.ParseInt(d.Id(), 10, 64) + if err != nil { + return err + } + repo, err := ws.Repos.GetByRepoId(ctx, id) + if err != nil { + return err + } + return common.StructToData(repo, s, d) + }, + Update: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error { + var update gitFolderUpdateStruct + common.DataToStructPointer(d, s, &update) + ws, err := c.WorkspaceClient() + if err != nil { + return err + } + repo := ws.Repos.Update(ctx, workspace.UpdateRepoRequest{ + Branch: update.Branch, + RepoId: update.RepoId, + SparseCheckout: update.SparseCheckout, + Tag: update.Tag, + }) + return common.StructToData(repo, s, d) + }, + Delete: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error { + ws, err := c.WorkspaceClient() + if err != nil { + return err + } + id, err := strconv.ParseInt(d.Id(), 10, 64) + if err != nil { + return err + } + return ws.Repos.DeleteByRepoId(ctx, id) + }, + Schema: s, + } +} + +func GetGitProviderFromUrl(uri string) string { + provider := "" + u, err := url.Parse(uri) + if err == nil { + lhost := strings.ToLower(u.Host) + provider = gitProvidersMap[lhost] + if provider == "" && awsCodeCommitRegex.FindStringSubmatch(lhost) != nil { + provider = "awsCodeCommit" + } + } + return provider +} diff --git a/repos/resource_git_folder_test.go b/repos/resource_git_folder_test.go new file mode 100644 index 0000000000..6f6ce87d2a --- /dev/null +++ b/repos/resource_git_folder_test.go @@ -0,0 +1,523 @@ +package repos + +import ( + "context" + "fmt" + "net/http" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/databricks/terraform-provider-databricks/common" + "github.com/databricks/terraform-provider-databricks/qa" +) + +func TestGetGitProviderFromUrl(t *testing.T) { + assert.Equal(t, "bitbucketCloud", GetGitProviderFromUrl("https://user@bitbucket.org/user/repo.git")) + assert.Equal(t, "gitHub", GetGitProviderFromUrl("https://github.com//user/repo.git")) + assert.Equal(t, "azureDevOpsServices", GetGitProviderFromUrl("https://user@dev.azure.com/user/project/_git/repo")) + assert.Equal(t, "", GetGitProviderFromUrl("https://abc/user/repo.git")) + assert.Equal(t, "", GetGitProviderFromUrl("ewfgwergfwe")) + assert.Equal(t, "awsCodeCommit", GetGitProviderFromUrl("https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo")) +} + +func TestResourceGitFolderRead(t *testing.T) { + repoID := 48155820875912 + repoIDStr := fmt.Sprintf("%d", repoID) + url := "https://user@github.com/user/repo.git" + provider := "gitHub" + branch := "main" + path := "/Repos/Production/testrepo" + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{ + { + Method: http.MethodGet, + Resource: fmt.Sprintf("/api/2.0/repos/%d", repoID), + Response: ReposInformation{ + ID: int64(repoID), + Url: url, + Provider: provider, + Branch: branch, + HeadCommitID: "7e0847ede61f07adede22e2bcce6050216489171", + Path: path, + }, + }, + }, + Resource: ResourceGitFolder(), + Read: true, + New: true, + ID: repoIDStr, + }.ApplyAndExpectData(t, + map[string]any{"id": repoIDStr, "path": path, "branch": branch, "git_provider": provider, + "url": url, "commit_hash": "7e0847ede61f07adede22e2bcce6050216489171", + "workspace_path": "/Workspace" + path}) +} + +func TestResourceGitFolderRead_NotFound(t *testing.T) { + repoID := "48155820875912" + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{ + { + Method: http.MethodGet, + Resource: fmt.Sprintf("/api/2.0/repos/%s", repoID), + Response: common.APIErrorBody{ + ErrorCode: "RESOURCE_DOES_NOT_EXIST", + Message: "Repo could not be found", + }, + Status: 404, + }, + }, + Resource: ResourceGitFolder(), + Read: true, + Removed: true, + ID: repoID, + }.Apply(t) +} + +func TestResourceGitFolderDelete(t *testing.T) { + repoID := "48155820875912" + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{ + { + Method: http.MethodDelete, + Resource: fmt.Sprintf("/api/2.0/repos/%s", repoID), + Status: http.StatusOK, + }, + }, + Resource: ResourceGitFolder(), + Delete: true, + ID: repoID, + }.ApplyAndExpectData(t, + map[string]any{"id": repoID}) +} + +func TestResourceGitFolderCreateNoBranch(t *testing.T) { + resp := ReposInformation{ + ID: 121232342, + Url: "https://github.com/user/test.git", + Provider: "gitHub", + Branch: "main", + Path: "/Repos/user@domain/test", + HeadCommitID: "1124323423abc23424", + } + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{ + { + Method: "POST", + Resource: "/api/2.0/repos", + ExpectedRequest: reposCreateRequest{ + Url: "https://github.com/user/test.git", + Provider: "gitHub", + }, + Response: resp, + }, + { + Method: "GET", + Resource: "/api/2.0/repos/121232342", + Response: resp, + }, + }, + Resource: ResourceGitFolder(), + State: map[string]any{ + "url": "https://github.com/user/test.git", + }, + Create: true, + }.ApplyAndExpectData(t, + map[string]any{"id": resp.RepoID(), "path": resp.Path, "branch": resp.Branch, + "git_provider": resp.Provider, "url": resp.Url, "commit_hash": resp.HeadCommitID}) +} + +func TestResourceGitFolderCreateCustomDirectory(t *testing.T) { + resp := ReposInformation{ + ID: 121232342, + Url: "https://github.com/user/test.git", + Provider: "gitHub", + Branch: "main", + Path: "/Repos/user@domain/test", + HeadCommitID: "1124323423abc23424", + } + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{ + { + Method: "POST", + Resource: "/api/2.0/repos", + ExpectedRequest: reposCreateRequest{ + Url: "https://github.com/user/test.git", + Provider: "gitHub", + Path: "/Repos/Production/test/", + }, + Response: resp, + }, + { + Method: "POST", + Resource: "/api/2.0/workspace/mkdirs", + ExpectedRequest: map[string]string{ + "path": "/Repos/Production", + }, + }, + { + Method: "GET", + Resource: "/api/2.0/repos/121232342", + Response: resp, + }, + }, + Resource: ResourceGitFolder(), + State: map[string]any{ + "url": "https://github.com/user/test.git", + "path": "/Repos/Production/test/", + }, + Create: true, + }.ApplyAndExpectData(t, + map[string]any{"id": resp.RepoID(), "path": resp.Path, "branch": resp.Branch, + "git_provider": resp.Provider, "url": resp.Url, "commit_hash": resp.HeadCommitID}) +} + +func TestResourceGitFolderCreateCustomDirectoryError(t *testing.T) { + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{ + { + Method: "POST", + Resource: "/api/2.0/workspace/mkdirs", + ExpectedRequest: map[string]string{ + "path": "/Repos/Production", + }, + Response: common.APIErrorBody{ + ErrorCode: "INVALID_REQUEST", + Message: "Internal error happened", + }, + Status: 400, + }, + }, + Resource: ResourceGitFolder(), + State: map[string]any{ + "url": "https://github.com/user/test.git", + "path": "/Repos/Production/test/", + }, + Create: true, + }.ExpectError(t, "Internal error happened") +} + +func TestResourceGitFolderCreateCustomDirectoryWrongLocation(t *testing.T) { + qa.ResourceFixture{ + Resource: ResourceGitFolder(), + State: map[string]any{ + "url": "https://github.com/user/test.git", + "path": "/Repos/Production/test/abc/", + }, + Create: true, + }.ExpectError(t, "invalid config supplied. [path] should have 3 components (/Repos//), got 4. Deprecated Resource") +} + +func TestResourceGitFolderCreateCustomDirectoryWrongPath(t *testing.T) { + qa.ResourceFixture{ + Resource: ResourceGitFolder(), + State: map[string]any{ + "url": "https://github.com/user/test.git", + "path": "/Repos/test/", + }, + Create: true, + }.ExpectError(t, "invalid config supplied. [path] should have 3 components (/Repos//), got 2. Deprecated Resource") +} + +func TestResourceGitFolderCreateWithBranch(t *testing.T) { + resp := ReposInformation{ + ID: 121232342, + Url: "https://github.com/user/test.git", + Provider: "gitHub", + Branch: "main", + Path: "/Repos/user@domain/test", + HeadCommitID: "1124323423abc23424", + } + respPatch := resp + respPatch.Branch = "releases" + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{ + { + Method: "POST", + Resource: "/api/2.0/repos", + ExpectedRequest: reposCreateRequest{ + Url: "https://github.com/user/test.git", + Provider: "gitHub", + }, + Response: resp, + }, + { + Method: "PATCH", + Resource: "/api/2.0/repos/121232342", + ExpectedRequest: map[string]any{"branch": "releases"}, + Response: respPatch, + }, + { + Method: "GET", + Resource: "/api/2.0/repos/121232342", + Response: respPatch, + }, + }, + Resource: ResourceGitFolder(), + State: map[string]any{ + "url": "https://github.com/user/test.git", + "branch": "releases", + }, + Create: true, + }.ApplyAndExpectData(t, + map[string]any{"id": resp.RepoID(), "path": resp.Path, "branch": respPatch.Branch, + "git_provider": resp.Provider, "url": resp.Url, "commit_hash": resp.HeadCommitID}) +} + +func TestResourceGitFolderCreateWithTag(t *testing.T) { + resp := ReposInformation{ + ID: 121232342, + Url: "https://github.com/user/test.git", + Provider: "gitHub", + Branch: "main", + Path: "/Repos/user@domain/test", + HeadCommitID: "1124323423abc23424", + } + respPatch := resp + respPatch.Branch = "" + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{ + { + Method: "POST", + Resource: "/api/2.0/repos", + ExpectedRequest: reposCreateRequest{ + Url: "https://github.com/user/test.git", + Provider: "gitHub", + }, + Response: resp, + }, + { + Method: "PATCH", + Resource: "/api/2.0/repos/121232342", + ExpectedRequest: map[string]any{"tag": "v0.1"}, + Response: respPatch, + }, + { + Method: "GET", + Resource: "/api/2.0/repos/121232342", + Response: respPatch, + }, + }, + Resource: ResourceGitFolder(), + State: map[string]any{ + "url": "https://github.com/user/test.git", + "tag": "v0.1", + }, + Create: true, + }.ApplyAndExpectData(t, + map[string]any{"id": resp.RepoID(), "path": resp.Path, + "git_provider": resp.Provider, "url": resp.Url, "commit_hash": resp.HeadCommitID}) +} + +func TestResourceGitFolderCreateError(t *testing.T) { + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{}, + Resource: ResourceGitFolder(), + State: map[string]any{ + "url": "https://somegit.com/user/test.git", + }, + Create: true, + }.ExpectError(t, "git_provider isn't specified and we can't detect provider from URL") +} + +func TestResourceGitFoldersUpdateSwitchToTag(t *testing.T) { + resp := ReposInformation{ + ID: 121232342, + Url: "https://github.com/user/test.git", + Provider: "gitHub", + Path: "/Repos/user@domain/test", + HeadCommitID: "1124323423abc23424", + } + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{ + { + Method: "PATCH", + Resource: "/api/2.0/repos/121232342", + ExpectedRequest: map[string]any{"tag": "v0.1"}, + Response: resp, + }, + { + Method: "GET", + Resource: "/api/2.0/repos/121232342", + Response: resp, + }, + }, + Resource: ResourceGitFolder(), + InstanceState: map[string]string{ + "url": "https://github.com/user/test.git", + "git_provider": "gitHub", + "path": "/Repos/user@domain/test", + "branch": "main", + }, + State: map[string]any{ + "url": "https://github.com/user/test.git", + "git_provider": "gitHub", + "path": "/Repos/user@domain/test", + "tag": "v0.1", + }, + ID: "121232342", + Update: true, + RequiresNew: true, + }.ApplyAndExpectData(t, map[string]any{"branch": ""}) +} + +func TestResourceGitFoldersUpdateSwitchToBranch(t *testing.T) { + resp := ReposInformation{ + ID: 121232342, + Url: "https://github.com/user/test.git", + Provider: "gitHub", + Path: "/Repos/user@domain/test", + HeadCommitID: "1124323423abc23424", + Branch: "releases", + } + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{ + { + Method: "PATCH", + Resource: "/api/2.0/repos/121232342", + ExpectedRequest: map[string]any{"branch": "releases"}, + Response: resp, + }, + { + Method: "GET", + Resource: "/api/2.0/repos/121232342", + Response: resp, + }, + }, + Resource: ResourceGitFolder(), + InstanceState: map[string]string{ + "url": "https://github.com/user/test.git", + "git_provider": "gitHub", + "path": "/Repos/user@domain/test", + "branch": "main", + }, + State: map[string]any{ + "url": "https://github.com/user/test.git", + "git_provider": "gitHub", + "path": "/Repos/user@domain/test", + "branch": "releases", + }, + ID: "121232342", + Update: true, + }.ApplyAndExpectData(t, map[string]any{"branch": "releases"}) +} + +func TestResourceGitFoldersUpdateSparseCheckout(t *testing.T) { + resp := ReposInformation{ + ID: 121232342, + Url: "https://github.com/user/test.git", + Provider: "gitHub", + Path: "/Repos/user@domain/test", + HeadCommitID: "1124323423abc23424", + } + qa.ResourceFixture{ + Fixtures: []qa.HTTPFixture{ + { + Method: "PATCH", + Resource: "/api/2.0/repos/121232342", + ExpectedRequest: map[string]any{"branch": "main", + "sparse_checkout": map[string]any{"patterns": []string{"abc", "def"}}, + }, + Response: resp, + }, + { + Method: "GET", + Resource: "/api/2.0/repos/121232342", + Response: resp, + }, + }, + Resource: ResourceGitFolder(), + InstanceState: map[string]string{ + "url": "https://github.com/user/test.git", + "git_provider": "gitHub", + "path": "/Repos/user@domain/test", + "branch": "main", + "sparse_checkout.0.patterns": `["abc"]`, + }, + HCL: ` + url = "https://github.com/user/test.git" + git_provider = "gitHub", + path = "/Repos/user@domain/test" + branch = "main" + sparse_checkout{ + patterns = ["abc", "def"] + } + `, + ID: "121232342", + Update: true, + RequiresNew: true, + }.ApplyAndExpectData(t, map[string]any{"branch": "main"}) +} + +func TestGitFoldersListAll(t *testing.T) { + resp := ReposInformation{ + ID: 121232342, + Url: "https://github.com/user/test.git", + Provider: "gitHub", + Path: "/Repos/user@domain/test", + HeadCommitID: "1124323423abc23424", + Branch: "releases", + } + + client, server, err := qa.HttpFixtureClient(t, []qa.HTTPFixture{ + { + Method: "GET", + Resource: "/api/2.0/repos?", + Response: ReposListResponse{ + NextPageToken: "12312423442343242343", + Repos: []ReposInformation{ + resp, + }, + }, + }, + { + Method: "GET", + Resource: "/api/2.0/repos?next_page_token=12312423442343242343", + Response: ReposListResponse{ + Repos: []ReposInformation{ + resp, + }, + }, + }, + }) + defer server.Close() + require.NoError(t, err) + + ctx := context.Background() + reposList, err := NewReposAPI(ctx, client).ListAll() + require.NoError(t, err) + assert.Equal(t, len(reposList), 2) + assert.Equal(t, resp.Branch, reposList[1].Branch) +} + +func TestGitFoldersListWithPrefix(t *testing.T) { + resp := ReposInformation{ + ID: 121232342, + Url: "https://github.com/user/test.git", + Provider: "gitHub", + Path: "/Repos/user@domain/test", + HeadCommitID: "1124323423abc23424", + Branch: "releases", + } + + client, server, err := qa.HttpFixtureClient(t, []qa.HTTPFixture{ + { + Method: "GET", + Resource: "/api/2.0/repos?path_prefix=%2FRepos%2Fabc", + Response: ReposListResponse{ + Repos: []ReposInformation{ + resp, + }, + }, + }, + }) + defer server.Close() + require.NoError(t, err) + + ctx := context.Background() + reposList, err := NewReposAPI(ctx, client).List("/Repos/abc") + require.NoError(t, err) + assert.Equal(t, len(reposList), 1) + assert.Equal(t, resp.Branch, reposList[0].Branch) +} diff --git a/repos/resource_repo.go b/repos/resource_repo.go index ab00947da4..e5b5549458 100644 --- a/repos/resource_repo.go +++ b/repos/resource_repo.go @@ -3,9 +3,7 @@ package repos import ( "context" "fmt" - "net/url" "path" - "regexp" "strings" "github.com/databricks/terraform-provider-databricks/common" @@ -127,29 +125,6 @@ func (a ReposAPI) ListAll() ([]ReposInformation, error) { return a.List("") } -var ( - gitProvidersMap = map[string]string{ - "github.com": "gitHub", - "dev.azure.com": "azureDevOpsServices", - "gitlab.com": "gitLab", - "bitbucket.org": "bitbucketCloud", - } - awsCodeCommitRegex = regexp.MustCompile(`^git-codecommit\.[^.]+\.amazonaws\.com$`) -) - -func GetGitProviderFromUrl(uri string) string { - provider := "" - u, err := url.Parse(uri) - if err == nil { - lhost := strings.ToLower(u.Host) - provider = gitProvidersMap[lhost] - if provider == "" && awsCodeCommitRegex.FindStringSubmatch(lhost) != nil { - provider = "awsCodeCommit" - } - } - return provider -} - func validatePath(i interface{}, k string) (_ []string, errors []error) { v := i.(string) if v == "" || !strings.HasPrefix(v, "/Repos/") { @@ -163,6 +138,7 @@ func validatePath(i interface{}, k string) (_ []string, errors []error) { return } +// Deprecated: Use databricks_git_folder instead func ResourceRepo() common.Resource { s := common.StructToSchema(ReposInformation{}, func(s map[string]*schema.Schema) map[string]*schema.Schema { s["url"].ValidateFunc = validation.IsURLWithScheme([]string{"https", "http"}) @@ -255,5 +231,6 @@ func ResourceRepo() common.Resource { Delete: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error { return NewReposAPI(ctx, c).Delete(d.Id()) }, + DeprecationMessage: "This resource is deprecated and will be removed in the future. Please use the `databricks_git_folder` resource instead.", } } diff --git a/repos/resource_repo_test.go b/repos/resource_repo_test.go index 288d36e39d..8eaa45ad6f 100644 --- a/repos/resource_repo_test.go +++ b/repos/resource_repo_test.go @@ -13,15 +13,6 @@ import ( "github.com/databricks/terraform-provider-databricks/qa" ) -func TestGetGitProviderFromUrl(t *testing.T) { - assert.Equal(t, "bitbucketCloud", GetGitProviderFromUrl("https://user@bitbucket.org/user/repo.git")) - assert.Equal(t, "gitHub", GetGitProviderFromUrl("https://github.com//user/repo.git")) - assert.Equal(t, "azureDevOpsServices", GetGitProviderFromUrl("https://user@dev.azure.com/user/project/_git/repo")) - assert.Equal(t, "", GetGitProviderFromUrl("https://abc/user/repo.git")) - assert.Equal(t, "", GetGitProviderFromUrl("ewfgwergfwe")) - assert.Equal(t, "awsCodeCommit", GetGitProviderFromUrl("https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo")) -} - func TestResourceRepoRead(t *testing.T) { repoID := 48155820875912 repoIDStr := fmt.Sprintf("%d", repoID) @@ -206,7 +197,7 @@ func TestResourceRepoCreateCustomDirectoryWrongLocation(t *testing.T) { "path": "/Repos/Production/test/abc/", }, Create: true, - }.ExpectError(t, "invalid config supplied. [path] should have 3 components (/Repos//), got 4") + }.ExpectError(t, "invalid config supplied. [path] should have 3 components (/Repos//), got 4. Deprecated Resource") } func TestResourceRepoCreateCustomDirectoryWrongPath(t *testing.T) { @@ -217,7 +208,7 @@ func TestResourceRepoCreateCustomDirectoryWrongPath(t *testing.T) { "path": "/Repos/test/", }, Create: true, - }.ExpectError(t, "invalid config supplied. [path] should have 3 components (/Repos//), got 2") + }.ExpectError(t, "invalid config supplied. [path] should have 3 components (/Repos//), got 2. Deprecated Resource") } func TestResourceRepoCreateWithBranch(t *testing.T) {