-
Notifications
You must be signed in to change notification settings - Fork 284
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
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
4f6c5e8
Created skeleton files
tmeckel 65495af
First working version of azuredevops_project_permissions
tmeckel 606375d
First working version of azuredevops_project_permissions
tmeckel cf85fd3
Initial version with security namespace helper functions
tmeckel 17b9632
Added function debugWait to support attaching a debugger
tmeckel 7581ab1
Added StringFromInterface to azuredevops\utils\converter\converter.go
tmeckel 06da06f
First working version of azuredevops_project_permissions using Securi…
tmeckel 9164013
Initial version of azuredevops_git_permissions
tmeckel 1ba217f
Added converter functions to hex encode and decode UTF-16 strings and…
tmeckel 42bd509
Added function RemovePrincipalPermissions to azuredevops\utils\securi…
tmeckel 38f58a9
Created schema helper function CreatePermissionResourceSchema azurede…
tmeckel 90756f3
First working version of project and git repository permissions, inlu…
tmeckel 509c0e5
Updated vendor folder with ahmetb/go-linq
tmeckel dbf7e83
Upgraded terraform-plugin-sdk to v1.10.0 in go.mod to import missing …
tmeckel d174d5e
Removed excessive GitClient declaration from azuredevops/utils/config…
tmeckel 311f3ed
Moved files to new locations accoring to new code base structure
tmeckel 502ae36
Applied changes according to new code base structure
tmeckel d2ee260
Implemented unit and acceptance test for permission framework , git_p…
tmeckel 34a5fd8
Fixed a bug for TestAccProject_CreateAndUpdate that has been introduc…
tmeckel 66bf85e
Added support for AZDO_PROVIDER_DEBUG_WAIT environment variable for d…
tmeckel a469f27
Implemented data source azuredevops_git_repository
tmeckel 494c9f3
Fixed a liniting error in azuredevops/internal/utils/debug/Debug.go
tmeckel 618cc33
Fixed a linting error in azuredevops/internal/service/permissions/uti…
tmeckel f64365b
Added documentation for permission resources
tmeckel 2cf64be
Fixed TestAccProject_CreateAndUpdateWithFeatures after rebased to cu…
tmeckel 4875ab9
Cleaned references to go-spew after removing single log message in az…
tmeckel e4acfab
Integrated into new master
tmeckel 28cf9a1
Fixed linting errors in azuredevops/internal/service/taskagent/resour…
tmeckel 2298ea3
Excluding acceptancetests folder from running unit tests in scripts/u…
tmeckel 0daa9b7
Excluding all other folders except the acceptancetests folder while r…
tmeckel 571b881
Changes applied according to first review
tmeckel 6c79a38
Removed Debug.Wait
tmeckel 1d6ff7e
Updated vendor
tmeckel a69b7bb
Applied requested changes after review
tmeckel 3f30c9c
Updated HCL example in website/docs/r/git_permissions.html.markdown
tmeckel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
azuredevops/internal/acceptancetests/data_git_repositories_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
azuredevops/internal/acceptancetests/data_git_repository_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, { | ||
Config: tfConfigStep2, | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet(tfNode, "project_id"), | ||
resource.TestCheckResourceAttr(tfNode, "name", gitRepoName), | ||
resource.TestCheckResourceAttr(tfNode, "default_branch", "refs/heads/master"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} |
34 changes: 34 additions & 0 deletions
34
azuredevops/internal/acceptancetests/resource_git_permissions_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} |
34 changes: 34 additions & 0 deletions
34
azuredevops/internal/acceptancetests/resource_project_permissions_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 stepThere was a problem hiding this comment.
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.