Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission management #18

Merged
merged 35 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4f6c5e8
Created skeleton files
tmeckel Oct 26, 2019
65495af
First working version of azuredevops_project_permissions
tmeckel Jan 10, 2020
606375d
First working version of azuredevops_project_permissions
tmeckel Jan 10, 2020
cf85fd3
Initial version with security namespace helper functions
tmeckel Jan 26, 2020
17b9632
Added function debugWait to support attaching a debugger
tmeckel Feb 1, 2020
7581ab1
Added StringFromInterface to azuredevops\utils\converter\converter.go
tmeckel Feb 1, 2020
06da06f
First working version of azuredevops_project_permissions using Securi…
tmeckel Feb 2, 2020
9164013
Initial version of azuredevops_git_permissions
tmeckel Feb 2, 2020
1ba217f
Added converter functions to hex encode and decode UTF-16 strings and…
tmeckel Mar 1, 2020
42bd509
Added function RemovePrincipalPermissions to azuredevops\utils\securi…
tmeckel Mar 1, 2020
38f58a9
Created schema helper function CreatePermissionResourceSchema azurede…
tmeckel Mar 1, 2020
90756f3
First working version of project and git repository permissions, inlu…
tmeckel Mar 1, 2020
509c0e5
Updated vendor folder with ahmetb/go-linq
tmeckel Apr 5, 2020
dbf7e83
Upgraded terraform-plugin-sdk to v1.10.0 in go.mod to import missing …
tmeckel Apr 20, 2020
d174d5e
Removed excessive GitClient declaration from azuredevops/utils/config…
tmeckel May 6, 2020
311f3ed
Moved files to new locations accoring to new code base structure
tmeckel Jun 6, 2020
502ae36
Applied changes according to new code base structure
tmeckel Jun 6, 2020
d2ee260
Implemented unit and acceptance test for permission framework , git_p…
tmeckel Jun 10, 2020
34a5fd8
Fixed a bug for TestAccProject_CreateAndUpdate that has been introduc…
tmeckel Jun 11, 2020
66bf85e
Added support for AZDO_PROVIDER_DEBUG_WAIT environment variable for d…
tmeckel Jun 12, 2020
a469f27
Implemented data source azuredevops_git_repository
tmeckel Jun 12, 2020
494c9f3
Fixed a liniting error in azuredevops/internal/utils/debug/Debug.go
tmeckel Jun 12, 2020
618cc33
Fixed a linting error in azuredevops/internal/service/permissions/uti…
tmeckel Jun 12, 2020
f64365b
Added documentation for permission resources
tmeckel Jun 12, 2020
2cf64be
Fixed TestAccProject_CreateAndUpdateWithFeatures after rebased to cu…
tmeckel Jun 12, 2020
4875ab9
Cleaned references to go-spew after removing single log message in az…
tmeckel Jun 12, 2020
e4acfab
Integrated into new master
tmeckel Jun 28, 2020
28cf9a1
Fixed linting errors in azuredevops/internal/service/taskagent/resour…
tmeckel Jun 28, 2020
2298ea3
Excluding acceptancetests folder from running unit tests in scripts/u…
tmeckel Jun 28, 2020
0daa9b7
Excluding all other folders except the acceptancetests folder while r…
tmeckel Jun 28, 2020
571b881
Changes applied according to first review
tmeckel Jun 29, 2020
6c79a38
Removed Debug.Wait
tmeckel Jul 1, 2020
1d6ff7e
Updated vendor
tmeckel Jul 1, 2020
a69b7bb
Applied requested changes after review
tmeckel Jul 7, 2020
3f30c9c
Updated HCL example in website/docs/r/git_permissions.html.markdown
tmeckel Jul 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 169 additions & 0 deletions azdosdkmocks/security_sdk_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build all core data_git_repositories
// +build !exclude_data_sources !exclude_data_git_repositories
// +build all data_sources git data_git_repositories
// +build !exclude_data_sources !exclude_git !exclude_data_git_repositories

package acceptancetests

Expand Down
41 changes: 41 additions & 0 deletions azuredevops/internal/acceptancetests/data_git_repository_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// +build all data_sources git data_git_repository
// +build !exclude_data_sources !exclude_git !data_git_repository

package acceptancetests

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/terraform-providers/terraform-provider-azuredevops/azuredevops/internal/acceptancetests/testutils"
)

// Verifies that the following sequence of events occurrs without error:
// (1) TF can create a project
// (2) A data source is added to the configuration, and that data source can find the created project
func TestAccGitRepository_DataSource(t *testing.T) {
projectName := testutils.GenerateResourceName()
gitRepoName := testutils.GenerateResourceName()
tfConfigStep1 := testutils.HclGitRepoResource(projectName, gitRepoName, "Clean")
tfConfigStep2 := fmt.Sprintf("%s\n%s", tfConfigStep1, testutils.HclProjectGitRepository(projectName, gitRepoName))

tfNode := "data.azuredevops_git_repository.repository"
resource.Test(t, resource.TestCase{
PreCheck: func() { testutils.PreCheck(t, nil) },
Providers: testutils.GetProviders(),
PreventPostDestroyRefresh: true,
Steps: []resource.TestStep{
{
Config: tfConfigStep1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this config was just for verify if terraform apply works? No check is configured for this step

Copy link
Contributor Author

@tmeckel tmeckel Jul 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simply copied the code that @nmiodice created to test the multi value data source in azuredevops/internal/acceptancetests/data_git_repositories_test.go If there is an issue here we have to check about the acceptance test in this data source as well.

}, {
Config: tfConfigStep2,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(tfNode, "project_id"),
resource.TestCheckResourceAttr(tfNode, "name", gitRepoName),
resource.TestCheckResourceAttr(tfNode, "default_branch", "refs/heads/master"),
),
},
},
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// +build all permissions resource_git_permissions
// +build !exclude_permissions !exclude_resource_git_permissions

package acceptancetests

import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/terraform-providers/terraform-provider-azuredevops/azuredevops/internal/acceptancetests/testutils"
)

func TestAccGitPermissions_SetPermissions(t *testing.T) {
projectName := testutils.GenerateResourceName()
config := testutils.HclGitPermissions(projectName)

tfNode := "azuredevops_git_permissions.git-permissions"
resource.Test(t, resource.TestCase{
PreCheck: func() { testutils.PreCheck(t, nil) },
Providers: testutils.GetProviders(),
CheckDestroy: testutils.CheckProjectDestroyed,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testutils.CheckProjectExists(projectName),
resource.TestCheckResourceAttrSet(tfNode, "project_id"),
resource.TestCheckResourceAttrSet(tfNode, "principal"),
resource.TestCheckResourceAttr(tfNode, "permissions.%", "3"),
),
},
},
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// (3) Group membership exists and can be queried for
// (4) TF destroy removes group memberships
//
// Note: This will be uncommented in https://github.com/microsoft/terraform-provider-azuredevops/issues/174
// Note: This will be uncommented in https://github.com/terraform-providers/terraform-provider-azuredevops/issues/174
//
func TestAccGroupMembership_CreateAndRemove(t *testing.T) {
t.Skip("Skipping test TestAccGroupMembership_CreateAndRemove: https://github.com/terraform-providers/terraform-provider-azuredevops/issues/174")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// +build all permissions resource_project_permissions
// +build !exclude_permissions !exclude_resource_project_permissions

package acceptancetests

import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/terraform-providers/terraform-provider-azuredevops/azuredevops/internal/acceptancetests/testutils"
)

func TestAccProjectPermissions_SetPermissions(t *testing.T) {
projectName := testutils.GenerateResourceName()
config := testutils.HclProjectPermissions(projectName)

tfNode := "azuredevops_project_permissions.project-permissions"
resource.Test(t, resource.TestCase{
PreCheck: func() { testutils.PreCheck(t, nil) },
Providers: testutils.GetProviders(),
CheckDestroy: testutils.CheckProjectDestroyed,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testutils.CheckProjectExists(projectName),
resource.TestCheckResourceAttrSet(tfNode, "project_id"),
resource.TestCheckResourceAttrSet(tfNode, "principal"),
resource.TestCheckResourceAttr(tfNode, "permissions.%", "4"),
),
},
},
})
}
Loading